Thread: Filelist Question

  1. #1
    Registered User 00Sven's Avatar
    Join Date
    Feb 2006
    Posts
    127

    Filelist Question

    i have been working on some programs with file I/O. I want to display a list of the files in the containing folder without the file extension. Currently I am using this
    Code:
    system("dir/b *.dat");
    That works but it displays the .dat extension and I owuld not like it to do that. I would either like to know how to make that system command only look for files without a file extension and then I would not need to save it as a .dat or I would need to print out the system command but taking away that file extension. If anyone could tell me which of those is possible and/or easier that would be great thanks!
    ~Sven

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    why don't you write the code to read the directory yourself. Its not that difficult. see _findfirstfile() and _findnextfile() or win32 api FindFirstFile() and FindNextFile(). *nix is a little different.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Isn't this in the FAQ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM