GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Sep-2005, 04:22
wadgie wadgie is offline
New Member
 
Join Date: Jan 2005
Posts: 19
wadgie is on a distinguished road

Non .txt file


I 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  
Old 02-Sep-2005, 05:12
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
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 GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 15:53.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.