![]() |
|
#1
|
|||
|
|||
Non .txt fileI am having a bit of trouble finding a file using my program.
Basically, within my current directory I want to find all files of a particular file extension. That will return about five files, of which I want to check the contents. The trick is that the files are not of .txt format but a driver file .inf format. How do I 1) Search for all *.inf files 2) Read a non txt file Thanks in advance if u can help me |
|||
|
#2
|
|||
|
|||
|
When searching for files you can use a variety of functions, including the opendir()/readdir() POSIX compliant ones, the findfirst()/findnext() functions declared in dir.h, or the WinAPI functions FindFirstFile()/FindNextFile(). Your choice, really, although I'd say the first set are the most widely supported of them all.
As for binary I/O, when using the stdio functions, you want to open the file with the mode "rb", or "wb" for writing, "ab" when appending, etc. Essentially you need a 'b' after the mode. Then you can use the binary I/O functions fread() and fwrite() to achieve whatever you needed done. Pretty much the same as text files. |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| Problem in saving file as .txt | shinyhui | MS Visual C++ / MFC Forum | 4 | 02-May-2005 22:06 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The