Reading contents from an .raw file in c++

Home Forums C Programming Reading contents from an .raw file in c++

This topic contains 0 replies, has 1 voice, and was last updated by  DanutaWilber 9 years, 10 months ago.

  • Author
  • #2154



    I am currently working on a project where i have a block.raw file. I am at the point where i can open the file, but i am having trouble reading the contents correctly. i am trying to read the contents one unsigned character at a time, but i get different results each time i do it. Any help is appreciated! Thnx in advanced.

    int main()

    unsigned char letter;

    ifstream indata; // indata is like cin
    ofstream outdata; “contents.txt” ); “block.raw” ); // opens the file

    if( !indata )
    { // file couldn’t be opened
    cerr < < "Error: file could not be opened" << endl;

    while ( !indata.eof( ) ) {

    indata >> letter;

    cout < < letter; outdata < < indata; //indata >> letter;


    cout < < endl; indata.close(); cout < < "End-of-file reached.." << endl; return 0; }

You must be logged in to reply to this topic.