"peggy83" <te******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
sorry i didnt define my question properly. I'm doing a directshow
transform filter (encoder and decoder) using directshow app filter
wizard and integrated with g729 speech codec for my final year project.
i need to check function by function to make sure each function works
well. so what should i do?
the application cannot use fprintf and string (it was shown
undeclared). any ways to solve?
i need to open a log file.
regards
peggy
if it's undeclared, you need to include the headers. std::string is
#include <string>
fprintf I'm not postive where it would be. Check your docs.
Why do you *need* to use fprintf? why can't you use iostreams? This is how
I do logging:
#include <string>
#include <fstream>
void LogMessage( const std::string& Message )
{
static std::ofstream LogFile("AbyssalLog.log");
if (LogFile.is_open())
{
LogFile << Message << std::endl;
}
}
Then when I want to send a log entry to my log I build it in a std::string
or use a constant.
std::string Temp = "Finished function: ThisFunc with return value: ";
Temp = Temp + StrmConvert<std::string>( ReturnVal );
LogMessage( Temp );
Or for simple entries:
LogMessage( "Finished function normally" );
The StrmConvert I use is like this:
#include <sstream>
template<typename T, typename F > T StrmConvert( F from )
{
std::stringstream temp;
temp << from;
T to = T();
temp >> to;
return to;
}