Re: FindFirstFile, how much faster than FindNextFile?
From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 02/12/05
- Next message: thatsalok: "Re: Problems with CStdioFile::WriteString"
- Previous message: konrad krupa: "Casting Objects"
- In reply to: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Next in thread: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Reply: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Feb 2005 20:36:01 -0800
Joe,
If you want to see really horrible, hair-raising code, open a recent CUJ
(January?) and check how the guy is creating XML request strings. I don't
have the copy in front of me, but IIRC, it's an article by some Neil Roodyn.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:qahp015kbp6bd55aeb777t9uvh0hlveed4@4ax.com...
>
> Why are you using strcpy? This already suggests serious problems with the
> code. It is not
> Unicode-aware programming for one thing, and it implies you have a
> fixed-size buffer into
> which you are copying a string, which immediately suggests that you are
> begging for some
> serious bug to arise. if FileName were a CString, then a simple assignment
> would have
> worked.
>
> Hint: if you ever write strcpy or strcat, THINK REAL HARD ABOUT WHY YOU
> DID IT. The answer
> is usually that you made a fundamental coding error. I use strcpy and
> strcat so
> infrequently that I find it a surprise when I need to do so (actually, the
> most often use
> I make of strcpy, or to be precise, _tcscpy, is putting the font name
> into a LOGFONT
> structure). I can't recall the last time I wrote strcat. Use CString, or
> if you like the
> C++ standard library, the string type. There is rarely a need in modern
> MFC programming to
> use cpy or cat functions. So rare that I don't believe it is appropriate
> here.
>
- Next message: thatsalok: "Re: Problems with CStdioFile::WriteString"
- Previous message: konrad krupa: "Casting Objects"
- In reply to: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Next in thread: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Reply: Joseph M. Newcomer: "Re: FindFirstFile, how much faster than FindNextFile?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|