getFileContents
Default mainpageApplicationShaderObjectgetFileContents
Description Source Call Graph
Start Line: 85
char * ShaderObject::getFileContents(const char *fileName)
{
    int length;
    char* buffer;

    // Load the file
    ifstream input(fileName);

    // Check to see that the file is open
    if (!input.is_open())
        return(NULL);

    // Get length of file:
    input.seekg(0, ios::end);
    length = input.tellg();
    input.seekg(0, ios::beg);

    // Allocate memory:
    buffer = new char[length];

    // Read data as a block:
    input.getline(buffer, length, '\0');

    // Close the input file
    input.close();

    // Return the shader code
    return(buffer);
}