An exasperating bug for your amusement.

Discussion in 'C++' started by Robbie Hatley, Apr 16, 2007.

  1. 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
     
    Robbie Hatley, Apr 16, 2007
    #1
    1. Advertising

  2. Robbie Hatley

    Howard Guest

    "Robbie Hatley" <> wrote in message
    news:rcyUh.515$...
    >
    > 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
     
    Howard, Apr 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Salerno
    Replies:
    2
    Views:
    478
    John Salerno
    Mar 18, 2006
  2. Holmespundit
    Replies:
    0
    Views:
    459
    Holmespundit
    Sep 1, 2004
  3. cutebravo
    Replies:
    2
    Views:
    292
  4. cutebravo

    Enhance your knowledge and boost your mind

    cutebravo, Jun 6, 2007, in forum: C Programming
    Replies:
    1
    Views:
    265
    Richard Heathfield
    Jun 6, 2007
  5. Paul McGuire
    Replies:
    0
    Views:
    831
    Paul McGuire
    Dec 20, 2007
Loading...

Share This Page