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.


Thanks
Ankur Shah

Recommended Answers

All 6 Replies

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.

What is the solution for that???

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.

What is the solution for that???

Write a function that searches the buffer.

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.