私の無知を許してください..私はかなりのことを知っていますが、どういうわけか基本についてまだ漠然としています!?!この簡単な例を考えて、ログメッセージを「writeLogFile」に渡す最良の方法を教えてください?
void writeLogFile (ofstream *logStream_ptr)
{
FILE* file;
errno_t err;
//will check this and put in an if statement later..
err = fopen_s(&file, logFileName, "w+" );
//MAIN PROB:how can I write the data passed to this function into a file??
fwrite(logStream_ptr, sizeof(char), sizeof(logStream_ptr), file);
fclose(file);
}
int _tmain(int argc, _TCHAR* argv[])
{
logStream <<"someText";
writeLogFile(&logStream); //this is not correct, but I'm not sure how to fix it
return 0;
}