Opening game files and running them C++

Write your question here.
I was wondering if someone could help me open some files to run a game.
To get useful replies you'll need to be specific about what in particular you want help with.
Consider reading http://catb.org/~esr/faqs/smart-questions.html
But be critical and disregard everything in that essay that isn't related to writing.
In C++ to open a file for reading you use std::ifstream
eg to open a text file:

1
2
3
4
5
6
7
8
9
10
11
#include <fstream>
#include <iostream>

int main() {
    std::ifstream ifs("filenametoopen.txt");

    if (!ifs)
        return (std::cout << "Cannot open file\n"), 1;

    // Read from file here - depends upon format of file
}


To open a binary file for input:

1
2
3
4
5
6
7
8
9
10
11
#include <fstream>
#include <iostream>

int main() {
    std::ifstream ifs("filenametoopen.dat", std::ifstream::binary);

    if (!ifs)
        return (std::cout << "Cannot open file\n"), 1;

    // Read from file here - depends upon format of file
}


Do you mean compile the game files, right?
Topic archived. No new replies allowed.