All pastes #107052 Raw Edit

Untitled

public cpp v1 · immutable
#107052 ·published 2006-07-30 20:14 UTC
rendered paste body
#include <iostream>#include <fstream>using namespace std;int main(){    char version [30];    char none[1];    char length[4];    /*        This is supposed to read a Guitar Pro-file using the description        at http://dguitar.sourceforge.net/GP4format.html.        Maybe I've done some things wrong since I'm still        a file reading beginner.    */    // Opening the stream.    fstream file("test.gp4",ios::in|ios::binary);    // The first 30 characters declare the version information.    // I don't know why there is a % after, why is that?    file.get(version, 30);    cout << "File version: " << version << endl;    // Then we have a null byte, I haven't really looked up a way to ignore yet so this is    // my temp solution    file.get(none, 1);    // Now there should be a 4 byte integer telling us how long the following string is+1.    // Since I know which GuitarPro-file I am using this value should be 13.    file.get(length, 4);    cout << "Length of title: " << length << endl;    // But it's empty. Why is that?    file.close();    return 0;}