Output STL string into file.
-
How to output string into a file? My part of code is below:(Look at the last line, it is not ok.) // Open the file ready write if((pOutputFileStream = fopen(csFilePath, "w")) != NULL) bStatus = TRUE; // Otherwise output message to the console window. else { printf("The output %s file is not available!", csFilePath); bStatus = FALSE; } if (bStatus) { // STL string. string str = vNode.back (); cout << str << endl; // // this line is not ok. // fprintf(pOutputFileStream, "%s", str.substr); } Thanks. mIchAel Liu __________________________________________________________ The secret of business is to know something that nobody else knows. ;)
-
How to output string into a file? My part of code is below:(Look at the last line, it is not ok.) // Open the file ready write if((pOutputFileStream = fopen(csFilePath, "w")) != NULL) bStatus = TRUE; // Otherwise output message to the console window. else { printf("The output %s file is not available!", csFilePath); bStatus = FALSE; } if (bStatus) { // STL string. string str = vNode.back (); cout << str << endl; // // this line is not ok. // fprintf(pOutputFileStream, "%s", str.substr); } Thanks. mIchAel Liu __________________________________________________________ The secret of business is to know something that nobody else knows. ;)
Use C++ instead of C. Longer reply in ATL/WTL/STL. I should add that if you're stuck with C files, you can use the c_str() function of a std::string to get a const char *. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002