istringstream ?

Discussion in 'C++' started by tvn007@hotmail.com, Nov 18, 2005.

  1. Guest

    Please help why this code not compile.
    //////////////////////////////////////////////////////////////////////////////////
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;

    ////////////////////////////////////////////////////////////
    // this code just read data from "test.txt"
    // put each line in string input_line
    // and print it out
    ////////////////////////////////////////////////////////////
    int main (void){

    ifstream in ("test.txt");
    string line;
    while (getline(in,line)){
    istringstream stream(line);
    }
    return 0;
    }
     
    , Nov 18, 2005
    #1
    1. Advertising

  2. Marcus Kwok Guest

    wrote:
    > Please help why this code not compile.
    > //////////////////////////////////////////////////////////////////////////////////
    > #include <iostream>
    > #include <string>
    > #include <fstream>


    #include <sstream>

    > using namespace std;
    >
    > ////////////////////////////////////////////////////////////
    > // this code just read data from "test.txt"
    > // put each line in string input_line
    > // and print it out
    > ////////////////////////////////////////////////////////////
    > int main (void){
    >
    > ifstream in ("test.txt");
    > string line;
    > while (getline(in,line)){
    > istringstream stream(line);
    > }
    > return 0;
    > }
    >


    --
    Marcus Kwok
     
    Marcus Kwok, Nov 18, 2005
    #2
    1. Advertising

  3. Default User Guest

    wrote:

    > Please help why this code not compile.



    In the future, help us out by including the compilation error messages.



    Brian

    --
    Please quote enough of the previous message for context. To do so from
    Google, click "show options" and use the Reply shown in the expanded
    header.
     
    Default User, Nov 18, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuele Armondi

    Allocating istringstream objects

    Samuele Armondi, Jul 11, 2003, in forum: C++
    Replies:
    1
    Views:
    371
    Samuele Armondi
    Jul 11, 2003
  2. Agent Mulder

    istringstream to bool

    Agent Mulder, Aug 23, 2003, in forum: C++
    Replies:
    8
    Views:
    1,029
    Agent Mulder
    Aug 24, 2003
  3. Viet Le Hong

    istringstream question

    Viet Le Hong, Sep 18, 2003, in forum: C++
    Replies:
    3
    Views:
    675
    Buster Copley
    Sep 18, 2003
  4. bml

    istringstream???

    bml, Jan 27, 2004, in forum: C++
    Replies:
    3
    Views:
    1,060
    Karl Heinz Buchegger
    Jan 27, 2004
  5. Donald Canton

    istringstream syntax error question

    Donald Canton, Jan 29, 2004, in forum: C++
    Replies:
    1
    Views:
    409
    David Harmon
    Jan 30, 2004
Loading...

Share This Page