a litle problem

In code compiller say "std::ifstream file' has initializer but incomplete type".
I work on codeblocks, wxwidgets, and windows xp.
As i see the code works in other people that use it. What here is wrong?
Jim.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

std::string OpenFile( const std::string& filename )
{
    std::ifstream file(filename.c_str(), std::ios::binary | std::ios::ate );
    file.seekg( 0, std::ios::end );
    int length; // initialize length
    length = file.tellg( );
    file.seekg( 0, std::ios::beg );
    char* buffer = new char[ length ];
    file.read( buffer, length );
    file.close( );
    std::string encrypted = buffer;
    delete buffer;
    return encrypted;
}
Last edited on
#include <fstream>
Ok all, thank's for help.
Topic archived. No new replies allowed.