Thread: Win API wildcard function??

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    39

    Win API wildcard function??

    In Win API is there a function that uses wildcards??

    I want to check the file extension in a path... (e.g. c:\windows\code.c)

    For instance:

    A function that would help me match this...

    c:\windows\*.c

    or

    *.c

    Thanks

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Look up FindFirstFile() and FindNextFile().
    zen

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    39
    Sorry Zen, I meant matching strings...

    Lets say lpCmdLine ...

    Happens to be c:\windows\something.txt

    I would like to match that file path, using wild cards, like this....

    *.txt

    or

    C:\windows\*.txt

    Should have been more specific

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    That's exactly what FindFirstFile() and FindNextFile() do.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    39
    One more try...I was still, apparently, too vague

    Let me just tell you what I am trying to do.
    In WinMain I want to check lpCmdLine with a function, which uses wildcards, to see if lpCmdLine (lpszArgs in my case) includes e.g. the .c extension, then have the application take a certain course of action. The function would, I suppose, use wildcards like this *.txt or c:\windows\*.txt when checking lpCmdLine.

    in the Win32 help file it says, "The FindFirstFile function searches a directory for a file whose name matches the specified filename."

    Sorry about that. I should of explained it this way before.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Use "?"

    ie .\???????????.exe
    Last edited by novacain; 11-19-2001 at 12:18 AM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  3. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  4. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM