Not so much a function, but a way
Say you are trying to open a file to write to
you'd need to #include <fstream>
then to open the file use:
Code:
ofstream myFile("local location of file");
but you always have to check if that file actually exists, or else it's be useless. so
Code:
if (! myFile)
{
cout << "Error\n";
return -1;
}
is that what you wanted? i imagine you could just use that even if you didn't want to write to the file.