Reading total amount in binary files

Hello, I would ask how to read how many total characters are in a binary file.
For example, the following strings are written in a binary file
Helloworld/0asdf/0thisisastring/0
There are no empty spaces and /0 is the terminating symbol.
So I have the task to determine the average number of characters in each string.
In this case it would be 27/3 = 9
Now my question is how to find out how many total characters are there and then divide them by the number of terminating symbols. (also how to find out the number of the terminating symbols)
Please help me, it can't be that hard.....
how to find out the number of the terminating symbols:
1
2
3
4
5
count(container, element):
   count <- 0
   traverse(container: iterator)
      if( iterator = element )
         count <- count+1
? what?
I am asking about C++ binary files something like
while (file.read...
what to type after this
ne555 has given you pseudo code because, you're right, it's not that hard. Here's mine: Read every character and count the NULLs, when the EOF is reached, look at the stream position.
Topic archived. No new replies allowed.