Created
March 22, 2015 20:59
-
-
Save reportbase/eda77ab2bf95aa9eebea to your computer and use it in GitHub Desktop.
echo binary file to octal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void echo_bin_octal(const char*, const char* path, void* app_, node<message*>** errors) | |
{ | |
int size; | |
unsigned char* buffer = load_binary(path, &size, errors); | |
if(*errors) | |
{ | |
push_message(errors, 0, 0, 1, __FILE__, __FUNCTION__, __LINE__, "bad path: %s", path); | |
return; | |
} | |
fprintf(stdout, "%s\n", path); | |
for(unsigned long n = 0; n < size; ++n) | |
fprintf(stdout, "\\%o", buffer[n]); | |
fprintf(stdout, "\n\n"); | |
free(buffer); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment