Re: Application Reading Itself
- From: "Ed Prochak" <edprochak@xxxxxxxxx>
- Date: 30 Jun 2006 10:59:06 -0700
ReaperUnreal wrote:
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?
so what do you mean by:
having trouble getting the? or by:
application to read itself
get it to work?
What errors do you get? what data do you get that you do not expect?
(how are you building the exe to guarantee the value you want is at the
end???)
We aren't mind readers. Explain the problem.
Ed
.
- References:
- Application Reading Itself
- From: ReaperUnreal
- Application Reading Itself
- Prev by Date: Re: So what Standard are we working off?
- Next by Date: Re: void vs void* (philosophical question)
- Previous by thread: Application Reading Itself
- Next by thread: Re: Application Reading Itself
- Index(es):