STL fstream brakedown in VS .NET?
-
Recently upgrading to VC++ .NET 2003, a logging utility using std::ofstream has broken. When outputting a string, the _address_ of the string gets into the log file and not the string contents!!! What is going on?? Addendum: Seems ostream has no << _Elem* operator. When I changed to write(...) it works like a charm. The standard has changed I guess... /R
-
Recently upgrading to VC++ .NET 2003, a logging utility using std::ofstream has broken. When outputting a string, the _address_ of the string gets into the log file and not the string contents!!! What is going on?? Addendum: Seems ostream has no << _Elem* operator. When I changed to write(...) it works like a charm. The standard has changed I guess... /R
Yes Robert. This was the most considerable change I was able to find out in VC.NET . You dont have streams now but still you can use STL's fstream and ostream etc. Just do a plain include like #include I hope this will solve your problem.
Stuck to Programming through an unbreakable bond :( My Articles
-
Yes Robert. This was the most considerable change I was able to find out in VC.NET . You dont have streams now but still you can use STL's fstream and ostream etc. Just do a plain include like #include I hope this will solve your problem.
Stuck to Programming through an unbreakable bond :( My Articles
Thanks Aamir, I'm not sure what you mean by the "plain include"? I do use the include: #include for the std::ifstream and std::ofstream STL classes. I checked the VC7 STL implementation and a lot of stream operators are available for the std::ofstream (through std::ostream). All _except_ char* (!!). For example, when the ofstream was passed a char* it used the operator << (void * ptr), so it was no wonder that the pointer value got into the text file instead of the string content. I'm not convinced that this is according to the standard, as STLPort is much more standard compliant and with STLPort it works just as intended. I guess the VC6 STL bugs just have been replaced by VC7 STL bugs... ;-) /Rob