Win API wildcard function??

This is a discussion on Win API wildcard function?? within the Windows Programming forums, part of the Platform Specific Boards category; In Win API is there a function that uses wildcards?? I want to check the file extension in a path... ...

  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
    zen
    zen is offline
    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,859
    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-17-2006, 12:35 AM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 09: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, 07:44 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21