|
-
Sep 5th, 2002, 02:56 PM
#1
Thread Starter
New Member
how do i read the size of an exe???
hey guys
i was just wondering how do i read the size of an exe when im copying a file.... my copy command that i made always stops at 215 b.....
thx guys
-
Sep 5th, 2002, 03:29 PM
#2
Frenzied Member
Two comments - you are hitting an ASCII 26 character at position 215 in the image header. When you open a binary file and read it as text, when you hit CTRL-Z (26) the read returns EOF.
Open the file as binary., write to a binary-open file.
Or do it the easy way:
Code:
int retval = CopyFile("C:\\folder\\file1.exe","d:\\folder\\anotherfile.exe",0L);
include windows.h
-
Sep 5th, 2002, 03:32 PM
#3
Frenzied Member
Oh. forgot.
stat the file to get it's size.
Code:
struct stat a;
if(stat("C:\\myfile.exe",&a) ){
perror("Cannot stat file");
exit(1);
}
printf("File size in bytes is %d\n",a.st_size);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|