GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


text file loading by jeickmann
FILE * file = fopen(filestring.c_str(), "r");
    
    if(file == NULL)
        cout << "WUPSY" << endl;

    fseek(file, 0, SEEK_END);
    long size = ftell(file);

    fseek(file, 0, SEEK_SET);

    char * cbuf = new char[size+1];
    fread(cbuf, 1, size, file);

    cbuf[size] = '\0';
    
    fclose(file);

    string result(cbuf);
    
    cout << "yy" << result << "yy\n";
    delete [] cbuf;