Why wont my writeToLog function work?

Started by
5 comments, last by Samsonite 18 years, 8 months ago
Thanks for taking time reading this:

void openLogFile(char* wich, ofstream* filehandle, bool* binary)
{
     if(binary)
     {
               filehandle.open(wich,ios::out,ios::binary);
               
     }else     {filehandle.open(wich,ios::out);}
}



Well, thats my function for opening my log file. The errors returned are as follows:

C:\Dev-Cpp\Heavy prog\heavymain.cpp In function `void openLogFile(char*, std::ofstream*, bool*)': 
15 C:\Dev-Cpp\Heavy prog\heavymain.cpp `open' has not been declared 
15 C:\Dev-Cpp\Heavy prog\heavymain.cpp request for member of non-aggregate type before '(' token 
17 C:\Dev-Cpp\Heavy prog\heavymain.cpp `open' has not been declared 



EDIT:Well, acctually many others have also been returned. But its for my writeToLog and closeLogFile functions, and the errors are much the same. I know it has to do with "filehandle" but i'm not sure how to fix it! Any help is appreciated! Thanks in advance.
Hope I was helpful. And thank you if you were!
Advertisement
filehandle is of pointer type use -> instead of . or pass it in by reference.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Thats wonderfull!Thanks!

I forgot that ofstream is a class

EDIT: Didn't solve the problem though. Now i get:

15 C:\Dev-Cpp\Heavy prog\heavymain.cpp no matching function for call to `std::basic_ofstream<char, std::char_traits<char> >::open(char*&, const std::_Ios_Openmode&, const std::_Ios_Openmode&)' 
Hope I was helpful. And thank you if you were!
filehandle.open(wich,ios::out,ios::binary);//should be filehandle.open(wich,ios::out|ios::binary);
Hope I was helpful. And thank you if you were!
Also "bool* binary" should be "bool binary".
Hope I was helpful. And thank you if you were!

This topic is closed to new replies.

Advertisement