Hi every body

I want to know how i can read a very large binary file in to a character array using c++. I can read the whole file by using fread function but when i go no searching anything in that character array. i cant search.
i have used strstr function to search the string. and i also want to cut the buffer in pieces.

Ankur Shah

8 Years
Discussion Span
Last Post by mvmalderen

Binary files have binary information, not text information. Therefore, string functions probably will not be effective on the buffer. There are probably NULL characters in the binary data which will stop any string function from continuing past the character.


ankur shah>What is the solution for that???

Did you work out to get the solution? What size of a file and what it contains?

Post complete or fragment of your program. Source code must be surrounded with code tags; Use # icon at the toolbar of editor.


Define 'LARGE', 1GB, 2GB, 10GB, 100GB ??
If it's for example 4GB, then you already need a computer with bunches of RAM, to read the whole file into a character array :P
As already mentioned: The buffer technique is the solution for this, try it out :)
When you've put together some code, you can post it down here, so we can take a look at it and see what advices we can give you to improve your code...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.