Application Reading Itself
- From: "ReaperUnreal" <reaperunreal@xxxxxxxxx>
- Date: 30 Jun 2006 10:35:32 -0700
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?
.
- Follow-Ups:
- Re: Application Reading Itself
- From: Malcolm
- Re: Application Reading Itself
- From: Ed Prochak
- Re: Application Reading Itself
- Prev by Date: Re: OT: Windows console programs (was Re: Function Pointers)
- Next by Date: Re: So what Standard are we working off?
- Previous by thread: String Character Conversion
- Next by thread: Re: Application Reading Itself
- Index(es):
Relevant Pages
|