I've written a program that outputs text from a file as hex. And this works like a charm. But in the example in the assignment the output starts with:

000000 ......
000010 ......
000020 ......

And that part I haven't figured out how to do! Any pointers? Any links/tutorials I should check out?

How is that to vague? In the example output the assignment shows that each "outputed" line starts with the numbers in the original post. (The rest of the lines is in hex)

Now, my program reads the file character by character. My theory is that to get the 000000 I have to read the file line by line. But I'm not sure about this and is therefore wondering if it's an easier way to do it? Can it be done by a for-loop? Something like:

for(int i = 0; i < x; i ++) // x because this will have to change with how many //lines the output requiers
{
cout << "0000" << i << "0" << endl;
}
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.