R
ReaperUnreal
I'm writing an application that will store some hidden and encrypted
data at the end of the file, however, I'm having trouble getting the
application to read itself. Here's the code I have:
FILE *myself = NULL;
if(!(myself = fopen("AppReader.exe", "rb")))
{
fprintf(stderr, "Cannot open file to read.");
}
fseek(myself, -8, SEEK_END);
char buffer[10];
fread(buffer, 1, 8, myself);
buffer[8] = '\0';
printf("String: %s\n", buffer);
fclose(myself);
I realize that this isn't exactly the safest application, and that I
have no real error measures in place, however this is just a test to
see if it will work.
So the question is, does anyone know how to get it to work?
data at the end of the file, however, I'm having trouble getting the
application to read itself. Here's the code I have:
FILE *myself = NULL;
if(!(myself = fopen("AppReader.exe", "rb")))
{
fprintf(stderr, "Cannot open file to read.");
}
fseek(myself, -8, SEEK_END);
char buffer[10];
fread(buffer, 1, 8, myself);
buffer[8] = '\0';
printf("String: %s\n", buffer);
fclose(myself);
I realize that this isn't exactly the safest application, and that I
have no real error measures in place, however this is just a test to
see if it will work.
So the question is, does anyone know how to get it to work?