Thread: char[1024] to c++ STL string

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    18

    char[1024] to c++ STL string

    Hi,

    how to convert it?

    char buffer[1024];
    fgets (buffer, sizeof(buffer), fp)
    // convert buffer to c++ STL string

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    49
    1st: you should use ifstream instead of fp;
    2nd: you can convert like this:
    Code:
    string str(buffer);
    str is which you need.
    Hello, everyone.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  2. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  3. problems with overloaded '+' again
    By Brain Cell in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2005, 05:13 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM