Click here to Skip to main content
14,303,339 members

C / C++ / MFC

 
GeneralRe: _findfirst and fopen very slow Pin
cristiapi1-Feb-19 0:29
membercristiapi1-Feb-19 0:29 
AnswerRe: _findfirst and fopen very slow Pin
leon de boer31-Jan-19 14:54
memberleon de boer31-Jan-19 14:54 
GeneralRe: _findfirst and fopen very slow Pin
Stefan_Lang31-Jan-19 21:36
memberStefan_Lang31-Jan-19 21:36 
GeneralRe: _findfirst and fopen very slow Pin
leon de boer1-Feb-19 4:42
memberleon de boer1-Feb-19 4:42 
GeneralRe: _findfirst and fopen very slow Pin
Stefan_Lang1-Feb-19 4:59
memberStefan_Lang1-Feb-19 4:59 
GeneralRe: _findfirst and fopen very slow Pin
cristiapi1-Feb-19 5:44
membercristiapi1-Feb-19 5:44 
GeneralRe: _findfirst and fopen very slow Pin
cristiapi1-Feb-19 6:24
membercristiapi1-Feb-19 6:24 
GeneralRe: _findfirst and fopen very slow Pin
leon de boer1-Feb-19 21:40
memberleon de boer1-Feb-19 21:40 
Quote:
What happens if I need to find "BCDE" or "S1 " or "01FA" or ...?

Label them differently with a special name obviously, all you are doing is coming up with a filenaming convention Smile | :)

Hell use the file extension you already have (*.states) and mask the bits of it for what special strings are in it

*.states = file with no special tags
*.states1 = file with special tag 1 in it
*.states2 = file with special tag 2 in it
*.states3 = file with special tag 1 & 2 in it
*.states4 = file with special tag 3 in it
*.states5 = file with special tag 1 & 3 in it
*.states6 = file with special tag 1 & 2 in it
*.states7 = file with special tag 1, 2 & 3 in it

You can know what tags are in the file without ever opening it all you need to know is the filename.

This is also obviously a windows program why aren't you using the Windows API for the file open and reading?

HANDLE Handle = CreateFile (fd.name, GENERIC_READ, FILE_SHARE_READ, 
		0,  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); // Open the file
if (Handle != INVALID_HANDLE_VALUE)
{
    DWORD Actual;
    ReadFile(Handle, &buf[0], sizeof(buf)-1, &Actual, 0); // Read a buffer-1 of data (1 byte for #0 at end)
    if (Actual > 0)
    {
       buf[Actual] = 0;   // Make sure asciiz terminated for next string op
       if(0 == _strnicmp(buf, "ABCD", 4)) {
            Save buf in a std::vector
       }
    }
    CloseHandle(Handle);
}

In vino veritas


modified 2-Feb-19 3:59am.

GeneralRe: _findfirst and fopen very slow Pin
cristiapi1-Feb-19 23:35
membercristiapi1-Feb-19 23:35 
GeneralRe: _findfirst and fopen very slow Pin
leon de boer2-Feb-19 0:33
memberleon de boer2-Feb-19 0:33 
AnswerRe: _findfirst and fopen very slow Pin
Stefan_Lang31-Jan-19 21:27
memberStefan_Lang31-Jan-19 21:27 
AnswerRe: _findfirst and fopen very slow Pin
Joe Woodbury1-Feb-19 5:36
professionalJoe Woodbury1-Feb-19 5:36 
AnswerRe: _findfirst and fopen very slow Pin
cristiapi2-Feb-19 1:13
membercristiapi2-Feb-19 1:13 
Questionwrite in .xlsx extension excel file using c++ Pin
Member 1413460229-Jan-19 23:49
memberMember 1413460229-Jan-19 23:49 
AnswerRe: write in .xlsx extension excel file using c++ Pin
Richard MacCutchan29-Jan-19 23:52
protectorRichard MacCutchan29-Jan-19 23:52 
AnswerRe: write in .xlsx extension excel file using c++ Pin
leon de boer30-Jan-19 2:09
memberleon de boer30-Jan-19 2:09 
RantC++ Typedefs Pin
nitrous_00729-Jan-19 4:45
membernitrous_00729-Jan-19 4:45 
GeneralRe: C++ Typedefs Pin
Richard MacCutchan29-Jan-19 5:41
protectorRichard MacCutchan29-Jan-19 5:41 
GeneralRe: C++ Typedefs Pin
David Crow29-Jan-19 6:20
memberDavid Crow29-Jan-19 6:20 
GeneralRe: C++ Typedefs Pin
Joe Woodbury29-Jan-19 9:45
professionalJoe Woodbury29-Jan-19 9:45 
GeneralRe: C++ Typedefs Pin
CPallini29-Jan-19 10:35
mveCPallini29-Jan-19 10:35 
GeneralRe: C++ Typedefs Pin
Stefan_Lang29-Jan-19 21:16
memberStefan_Lang29-Jan-19 21:16 
GeneralRe: C++ Typedefs Pin
leon de boer30-Jan-19 3:20
memberleon de boer30-Jan-19 3:20 
QuestionWhere do you place your #includes? Pin
den2k8828-Jan-19 23:49
professionalden2k8828-Jan-19 23:49 
AnswerRe: Where do you place your #includes? Pin
Daniel Pfeffer29-Jan-19 0:32
professionalDaniel Pfeffer29-Jan-19 0:32 

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

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