Thread: Open an unknown lonely file in a dir?

  1. #1

    Open an unknown lonely file in a dir?

    How can I open a file in directory that that will be the only file in that directory but I woun't know the name of it?
    I want to open the file read it and delete it and an other application will put a new file there...
    Thanks. /H

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    What compiler/OS are you using? (It'll be non-standard functions to do that type of thing)
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    For a standard (though hackish and slow) method, you could always attempt loading every combination of name (providing of course, that you know the file extension, and that we're assuming 8 character file names max) and checking for its existance.

    Actually I think theres a Win32 function that gets the file names in a directory and returns them in the form of a pointer to array of strings... Unfortunatly I cant seem to find it. Sorry.
    "There's always another way"
    -lightatdawn (

  4. #4
    I lurk
    Join Date
    Aug 2002
    Look up FindFirstFile() and FindNextFile() on

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM