Click here to Skip to main content
       

C / C++ / MFC

 
GeneralRe: Problem loading non-default wab PinmemberMember 86892612-Jan-13 5:17 
GeneralRe: Problem loading non-default wab PinmemberCode-o-mat12-Jan-13 9:09 
QuestionRe: Problem loading non-default wab PinmvpRichard MacCutchan11-Jan-13 7:41 
AnswerRe: Problem loading non-default wab PinmemberMember 86892611-Jan-13 10:53 
GeneralRe: Problem loading non-default wab PinmvpRichard MacCutchan12-Jan-13 0:17 
GeneralRe: Problem loading non-default wab PinmemberMember 86892612-Jan-13 5:06 
GeneralRe: Problem loading non-default wab PinmvpRichard MacCutchan12-Jan-13 5:20 
QuestionHow do you get the file size for an open file? PinmemberMember 41945938-Jan-13 4:29 
I have the following code:
 
    FILE *fp = stdin;
 
    if ((fp = fopen(argv[optind], "rb")) == NULL) {
         printf("Cannot open file %s\n", argv[optind]);
         return 2;
    }
 
It executes correctly and the correct file is accessed.
 
I added the following to get the file size:
 
    SizeLow = GetFileSize(_fileno(fp), & SizeHigh);
    if ((SizeLow == 0xFFFFFFFF) && ((Error = GetLastError()) != NO_ERROR)) {
         printf("Cannot read file size for %s, error %d\n", argv[optind], Error);
         help();
         return 2;
    }
    if (binary && (SizeHigh > 0x70000000)) {
        printf("File too big for Binary Mode\n");
        help();
        return 2;
    }
    __asm {
              mov   eax,SizeLow
              mov   edx,SizeHigh
              cmp   binary,TRUE
              jnz   Bytes
              shld  edx,eax,3
              shl   eax,3
          Bytes:
              mov   DWORD PTR totalc,eax
              mov   DWORD PTR totalc+4,edx
          }
 
When I execute I get the following:
 
ent.exe f:\tst1.tst  >ent1.txt
Cannot read file size for f:\tst1.tst, error 6
 
What am I doing wrong with the the GetFileSize call?
 
In case you are wondering, this is a modification to John Walker's ENT to speed up execution for huge files.
 
Dave.
AnswerRe: How do you get the file size for an open file? PinmemberJochen Arndt8-Jan-13 5:14 
GeneralRe: How do you get the file size for an open file? PinmemberMember 41945938-Jan-13 11:27 
GeneralRe: How do you get the file size for an open file? PinmemberMember 41945938-Jan-13 13:24 
QuestionWhile launching a winapp as ole server some time OnFIleNew() failed Pinmembervermaashish_mca8-Jan-13 2:36 
AnswerRe: While launching a winapp as ole server some time OnFIleNew() failed PinmemberJochen Arndt8-Jan-13 3:51 
QuestionIcon/Bitmap missing in 1st control (MFC dialog) Pinmember_jg_7-Jan-13 23:52 
QuestionThe task runtime question of RTOS. Pinmemberecony7-Jan-13 6:22 
AnswerRe: The task runtime question of RTOS. Pinmemberjeron17-Jan-13 6:35 
AnswerRe: The task runtime question of RTOS. [modified] PinmemberJoe Woodbury7-Jan-13 11:28 
GeneralTreeview After Select Event PinmemberVarun Pandey7-Jan-13 3:49 
GeneralRe: Treeview After Select Event Pinmemberjeron17-Jan-13 6:08 
Questionhow to hide a column of a listctrl Pinmembercherry7297-Jan-13 1:55 
AnswerRe: how to hide a column of a listctrl PinprotectorPete O'Hanlon7-Jan-13 2:16 
QuestionCreating Non-Rectangular Forms PinmemberLuca D'Amico6-Jan-13 12:38 
SuggestionRe: Creating Non-Rectangular Forms PinmemberDavidCrow6-Jan-13 18:25 
AnswerRe: Creating Non-Rectangular Forms Pinmember«_Superman_»6-Jan-13 18:56 
AnswerRe: Creating Non-Rectangular Forms PinmvpRichard MacCutchan6-Jan-13 23:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 26 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid