Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Advantages of Binary Files over Text files in Search and read

Reply
Thread Tools

Advantages of Binary Files over Text files in Search and read

 
 
utab
Guest
Posts: n/a
 
      11-28-2006
Dear all,

What are the advantages of binary files over text files? I would like
to search for a specific value of a variable in an output file, I was
doing this lately by the string library functions of the language. But
wondering the advantages of searching and reading from a binary file.
If the files get too large, I guess the advantage of reading from a
binary file is that it is much faster.

Regards,

 
Reply With Quote
 
 
 
 
Daniel T.
Guest
Posts: n/a
 
      11-28-2006
"utab" <(E-Mail Removed)> wrote:

> What are the advantages of binary files over text files? I would like
> to search for a specific value of a variable in an output file, I was
> doing this lately by the string library functions of the language. But
> wondering the advantages of searching and reading from a binary file.
> If the files get too large, I guess the advantage of reading from a
> binary file is that it is much faster.


An FAQ

http://www.parashift.com/c++-faq-lit....html#faq-36.3

--
To send me email, put "sheltie" in the subject.
 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      11-28-2006
utab wrote:
> What are the advantages of binary files over text files?


The latter are human-readable and are used for text-based applications
(e.g. a config file), while the former can be smaller and are used when
the data is not textual in nature (e.g., an image).

> I would like
> to search for a specific value of a variable in an output file, I was
> doing this lately by the string library functions of the language. But
> wondering the advantages of searching and reading from a binary file.
> If the files get too large, I guess the advantage of reading from a
> binary file is that it is much faster.


If it's all text that you're processing, then there may be no advantage
to using a binary file. You'll have to give us more details about what
it is you are saving to a file and searching for in order for us to
give you a better answer.

Cheers! --M

 
Reply With Quote
 
ionut.neicu@gmail.com
Guest
Posts: n/a
 
      11-28-2006
The implementations on different platforms can introduce various
differences.
Remember, if you open file in the text mode, you cant read over the EOF
char.
This is a problem if the file is a binary file ( an image for example
).

Text files, are usually sequential ( you cant't seek random in file ).
The sequential mode is sightly faster as random access.
Also text files can be optimized for sequential access. This option
can improve significant file acces speed.

Read CreateFile documentation from Windows API.
If you use Windows, use CreateFile with SEQUENTIAL_SCAN flag instead of
fopen, or so. The improvement in read speed is spectacular !


utab wrote:
> Dear all,
>
> What are the advantages of binary files over text files? I would like
> to search for a specific value of a variable in an output file, I was
> doing this lately by the string library functions of the language. But
> wondering the advantages of searching and reading from a binary file.
> If the files get too large, I guess the advantage of reading from a
> binary file is that it is much faster.
>
> Regards,


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary tree search vs Binary search Bogdan C Programming 22 10-21-2010 09:46 PM
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
Advantages of RAID6 Over RAID0 and RAID5 Silverstrand Front Page News 0 04-17-2006 05:47 PM
Advantages of using custom collections over datatables to bind to a datagrid? John Dalberg ASP .Net 4 12-08-2005 07:39 PM
Advantages of HTML Strict over Transitional Sally Thompson HTML 10 06-26-2004 06:56 AM



Advertisments