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
Printable View
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
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:
include windows.hCode:int retval = CopyFile("C:\\folder\\file1.exe","d:\\folder\\anotherfile.exe",0L);
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);