Original Post
id like to know if this code is ok or not, if its ok to return the pointer from the functon like that, it compiles and runs ok, but im not shure of it
#include <stdio.h>
FILE* OpenFile(char *srcFile)
{
FILE* pFile;
if (!(pFile = fopen(srcFile,"rt")))
{
pFile = NULL;
cout << "error opening " << srcFile << " for read\n";
}
cout << "before: " << pFile << "\n";
return pFile;
}
main()
{
FILE* pSource = OpenFile("src.txt");
cout << "after: " << &pSource << "\n";
return 0;
}