Posted on 2004-09-07
I'm trying to write the value of curCommand into the file pointed to by m_file.
The type of curCommand is String.
When I run the program using the line: fprintf ( m_file, "%s\n", curCommand ) ;
I get in the file garbage instead of the string in curCommand.
When I compile the program using the line: fprintf ( m_file, "%s\n", (char*)curCommand ) ;
I get the error below:
error C2440: 'type cast' : cannot convert from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'char *'
How can I print the data stored in the String argument ? note that in the debug winow I see that curCommand has the correct value.