Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. STL fstream brakedown in VS .NET?

STL fstream brakedown in VS .NET?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questioncsharpvisual-studiotools
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Bielik
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • R Robert Bielik

      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

      A Offline
      A Offline
      Aamir Butt
      wrote on last edited by
      #2

      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


      R 1 Reply Last reply
      0
      • A Aamir Butt

        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


        R Offline
        R Offline
        Robert Bielik
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups