Click here to Skip to main content
11,432,119 members (57,577 online)

C / C++ / MFC

 
AnswerRe: Problem loading non-default wab Pin
Code-o-mat10-Jan-13 3:06
memberCode-o-mat10-Jan-13 3:06 
GeneralRe: Problem loading non-default wab Pin
Member 86892611-Jan-13 7:05
memberMember 86892611-Jan-13 7:05 
GeneralRe: Problem loading non-default wab Pin
Code-o-mat11-Jan-13 8:49
memberCode-o-mat11-Jan-13 8:49 
GeneralRe: Problem loading non-default wab Pin
Member 86892611-Jan-13 10:56
memberMember 86892611-Jan-13 10:56 
GeneralRe: Problem loading non-default wab Pin
Code-o-mat11-Jan-13 11:07
memberCode-o-mat11-Jan-13 11:07 
GeneralRe: Problem loading non-default wab Pin
Code-o-mat11-Jan-13 11:12
memberCode-o-mat11-Jan-13 11:12 
GeneralRe: Problem loading non-default wab Pin
Member 86892612-Jan-13 5:17
memberMember 86892612-Jan-13 5:17 
GeneralRe: Problem loading non-default wab Pin
Code-o-mat12-Jan-13 9:09
memberCode-o-mat12-Jan-13 9:09 
QuestionRe: Problem loading non-default wab Pin
Richard MacCutchan11-Jan-13 7:41
mvpRichard MacCutchan11-Jan-13 7:41 
AnswerRe: Problem loading non-default wab Pin
Member 86892611-Jan-13 10:53
memberMember 86892611-Jan-13 10:53 
GeneralRe: Problem loading non-default wab Pin
Richard MacCutchan12-Jan-13 0:17
mvpRichard MacCutchan12-Jan-13 0:17 
GeneralRe: Problem loading non-default wab Pin
Member 86892612-Jan-13 5:06
memberMember 86892612-Jan-13 5:06 
GeneralRe: Problem loading non-default wab Pin
Richard MacCutchan12-Jan-13 5:20
mvpRichard MacCutchan12-Jan-13 5:20 
QuestionHow do you get the file size for an open file? Pin
Member 41945938-Jan-13 4:29
memberMember 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? Pin
Jochen Arndt8-Jan-13 5:14
memberJochen Arndt8-Jan-13 5:14 
GeneralRe: How do you get the file size for an open file? Pin
Member 41945938-Jan-13 11:27
memberMember 41945938-Jan-13 11:27 
GeneralRe: How do you get the file size for an open file? Pin
Member 41945938-Jan-13 13:24
memberMember 41945938-Jan-13 13:24 
QuestionWhile launching a winapp as ole server some time OnFIleNew() failed Pin
vermaashish_mca8-Jan-13 2:36
membervermaashish_mca8-Jan-13 2:36 
AnswerRe: While launching a winapp as ole server some time OnFIleNew() failed Pin
Jochen Arndt8-Jan-13 3:51
memberJochen Arndt8-Jan-13 3:51 
QuestionIcon/Bitmap missing in 1st control (MFC dialog) Pin
_jg_7-Jan-13 23:52
member_jg_7-Jan-13 23:52 
QuestionThe task runtime question of RTOS. Pin
econy7-Jan-13 6:22
memberecony7-Jan-13 6:22 
AnswerRe: The task runtime question of RTOS. Pin
jeron17-Jan-13 6:35
memberjeron17-Jan-13 6:35 
AnswerRe: The task runtime question of RTOS. [modified] Pin
Joe Woodbury7-Jan-13 11:28
memberJoe Woodbury7-Jan-13 11:28 
GeneralTreeview After Select Event Pin
Varun Pandey7-Jan-13 3:49
memberVarun Pandey7-Jan-13 3:49 
GeneralRe: Treeview After Select Event Pin
jeron17-Jan-13 6:08
memberjeron17-Jan-13 6:08 
Questionhow to hide a column of a listctrl Pin
cherry7297-Jan-13 1:55
membercherry7297-Jan-13 1:55 
AnswerRe: how to hide a column of a listctrl Pin
Pete O'Hanlon7-Jan-13 2:16
protectorPete O'Hanlon7-Jan-13 2:16 
QuestionCreating Non-Rectangular Forms Pin
Luca D'Amico6-Jan-13 12:38
memberLuca D'Amico6-Jan-13 12:38 
SuggestionRe: Creating Non-Rectangular Forms Pin
DavidCrow6-Jan-13 18:25
memberDavidCrow6-Jan-13 18:25 
AnswerRe: Creating Non-Rectangular Forms Pin
«_Superman_»6-Jan-13 18:56
member«_Superman_»6-Jan-13 18:56 
AnswerRe: Creating Non-Rectangular Forms Pin
Richard MacCutchan6-Jan-13 23:13
mvpRichard MacCutchan6-Jan-13 23:13 
GeneralRe: Creating Non-Rectangular Forms Pin
Luca D'Amico7-Jan-13 14:05
memberLuca D'Amico7-Jan-13 14:05 
Questionstd::vector problem Pin
Super Lloyd6-Jan-13 2:21
memberSuper Lloyd6-Jan-13 2:21 
AnswerRe: std::vector problem Pin
CPallini6-Jan-13 8:14
mvpCPallini6-Jan-13 8:14 
GeneralRe: std::vector problem Pin
Super Lloyd6-Jan-13 12:53
memberSuper Lloyd6-Jan-13 12:53 
QuestionStatic link to ATL alwayas fail Pin
Falconapollo5-Jan-13 0:19
memberFalconapollo5-Jan-13 0:19 
AnswerRe: Static link to ATL alwayas fail Pin
Richard MacCutchan5-Jan-13 2:28
mvpRichard MacCutchan5-Jan-13 2:28 
Questionhow to use a work thread write file and the main thread show a carton Pin
cherry7294-Jan-13 23:12
membercherry7294-Jan-13 23:12 
SuggestionRe: how to use a work thread write file and the main thread show a carton Pin
DavidCrow5-Jan-13 12:41
memberDavidCrow5-Jan-13 12:41 
AnswerRe: how to use a work thread write file and the main thread show a carton Pin
Albert Holguin6-Jan-13 7:14
memberAlbert Holguin6-Jan-13 7:14 
GeneralRe: how to use a work thread write file and the main thread show a carton Pin
cherry7296-Jan-13 15:58
membercherry7296-Jan-13 15:58 
AnswerRe: how to use a work thread write file and the main thread show a carton Pin
Randor 6-Jan-13 18:39
member Randor 6-Jan-13 18:39 
QuestioncapDriverConnect displays captured frame in CView Pin
Vaclav_Sal4-Jan-13 17:15
memberVaclav_Sal4-Jan-13 17:15 
QuestionWhat is the merit to rewrite memcpy? [modified] Pin
econy4-Jan-13 8:31
memberecony4-Jan-13 8:31 
AnswerRe: What is the merit to rewrite memcpy? Pin
Richard MacCutchan4-Jan-13 10:19
mvpRichard MacCutchan4-Jan-13 10:19 
GeneralRe: What is the merit to rewrite memcpy? Pin
econy4-Jan-13 11:31
memberecony4-Jan-13 11:31 
GeneralRe: What is the merit to rewrite memcpy? Pin
jeron14-Jan-13 11:49
memberjeron14-Jan-13 11:49 
GeneralRe: What is the merit to rewrite memcpy? Pin
Richard MacCutchan5-Jan-13 2:20
mvpRichard MacCutchan5-Jan-13 2:20 
AnswerRe: What is the merit to rewrite memcpy? Pin
jschell6-Jan-13 6:02
memberjschell6-Jan-13 6:02 
AnswerRe: What is the merit to rewrite memcpy? [modified] Pin
Joe Woodbury7-Jan-13 11:15
memberJoe Woodbury7-Jan-13 11:15 

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
Web03 | 2.8.150428.2 | Last Updated 4 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid