Results 1 to 3 of 3

Thread: how do i read the size of an exe???

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    1

    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

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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

  3. #3
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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
  •  



Click Here to Expand Forum to Full Width