Menu

File loading in c++/win32

2003-01-21
2012-09-26
  • Nobody/Anonymous

    I need to load a word from a file. I've been using ifstream and strings but the problem is that I also need to use it in win32 and strings don't work there enough. Is there any other way to do this without strings and/or ifstream.

    - reC

     
    • Nobody/Anonymous

      Why not use strings to read in the data and then convert it to a C style string using the convertor function c_str() ??

      e.g.

      string     aStr;
      ifstream aFile;

      aFile.open("myfile.txt");
      aFile >> aStr;

      then use aStr.c_str(); wherever you need a C style string.

      BlakJak :]

       
    • Nobody/Anonymous

      But if I need to for example set editbox's text I need to have char* to hold text how to convert a string to use it on that.
      And I'm using c++ not c

      - reC

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.