Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > An exasperating bug for your amusement.

Reply
Thread Tools

An exasperating bug for your amusement.

 
 
Robbie Hatley
Guest
Posts: n/a
 
      04-15-2007

Here's a bug I found in a program of mine, after much
exasperation trying to find out why this wasn't working.
You all might find it educational and/or entertaining.

I had this line of code:

rhdir::LoadFileList(RawFiles, "qgv??-raw.txt");

Basically, it looks for files in the current directory
named "qgv??-raw.txt" (where the question marks are
being used in the context of wildcard characters),
and loads the names of all such files into a
std::list<std::string> object named "RawFiles".
Seems very simple.

And yet, although I had a bunch of files named:

qgv17-raw.txt
qgv32-raw.txt
qgv88-raw.txt

none of them were getting into the list. What went
wrong?

You ain't gonna believe this....

The function LoadFileList() was actually looking for
a file named "qgv~raw.txt", and since there was no
such file, the "RawFiles" list remained empty.

Why?

The answer is: the character sequence ??- is NOT
three characters! It's ONE character, a tilde ~ .
It's one of those blasted "triglyph" thingies left
over from the days when certain characters weren't
actually on keyboards and had to be "faked".

So I backslashed the question marks:

rhdir::LoadFileList(RawFiles, "qgv\?\?-raw.txt");

and the program worked fine. Live and learn.

--
Cheers,
Robbie Hatley
lonewolfintj aatt pacbell dott net
triple-dubya dott tustinfreezone dott org


 
Reply With Quote
 
 
 
 
Howard
Guest
Posts: n/a
 
      04-16-2007

"Robbie Hatley" <(E-Mail Removed)> wrote in message
news:rcyUh.515$(E-Mail Removed). ..
>
> Here's a bug I found in a program of mine, after much
> exasperation trying to find out why this wasn't working.
> You all might find it educational and/or entertaining.
>
> I had this line of code:
>
> rhdir::LoadFileList(RawFiles, "qgv??-raw.txt");
>
> Basically, it looks for files in the current directory
> named "qgv??-raw.txt" (where the question marks are
> being used in the context of wildcard characters),
> and loads the names of all such files into a
> std::list<std::string> object named "RawFiles".
> Seems very simple.
>
> And yet, although I had a bunch of files named:
>
> qgv17-raw.txt
> qgv32-raw.txt
> qgv88-raw.txt
>
> none of them were getting into the list. What went
> wrong?
>
> You ain't gonna believe this....
>
> The function LoadFileList() was actually looking for
> a file named "qgv~raw.txt", and since there was no
> such file, the "RawFiles" list remained empty.
>
> Why?
>
> The answer is: the character sequence ??- is NOT
> three characters! It's ONE character, a tilde ~ .
> It's one of those blasted "triglyph" thingies left
> over from the days when certain characters weren't
> actually on keyboards and had to be "faked".
>
> So I backslashed the question marks:
>
> rhdir::LoadFileList(RawFiles, "qgv\?\?-raw.txt");
>
> and the program worked fine. Live and learn.
>


One of my compilers often complains that I've got "invalid triglyphs",
because in my comments when developing I often put ??? at the end of a
comment when I'm not sure of what I've written and want to come back and
revisit that point later. But I found that the compiler has an option to
turn off triglyph recognition entirely. Perhaps yours has that option?

-Howard

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
ZoneAlarm has detected a problem with your installation, and therefore has restricted Internet access from your machine for your protection. Donít panic A Teuchter Computer Support 2 05-19-2005 09:20 PM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM



Advertisments