Uniform input stream from various kind of sources ?

Discussion in 'C++' started by fabricemarchant@free.fr, Jun 20, 2006.

  1. Guest

    Hi !

    I'm writing a tiny interpreted language. The interpreter will first
    be able to load a list of source files before giving the hand to the
    keyboard : I use GNU readline/history library that returns the line
    input string that could be converted into a stream by std::istrstream.

    My aim is to cut the interpreter from this input system by feeding it
    with a unique input stream.
    Maybe I could use <sstream> to build this input stream. It is
    maybepossible inside a buffered input to switch from one source file
    to another one and then to the istrstream of readline() ?

    I have always neglected to seriously study input / output streams and
    always used them in a poor basic way... it's a shame since they do
    carry a powerful abstraction feature that can make the things a lot
    easier.

    Please can you give me an idea of a frame to build this unified input
    stream ?

    Thanks in advance.

    Fabrice
     
    , Jun 20, 2006
    #1
    1. Advertising

  2. Jerry Coffin Guest

    In article <1150831977.842063.152980
    @r2g2000cwb.googlegroups.com>,
    says...
    > Hi !
    >
    > I'm writing a tiny interpreted language. The interpreter will first
    > be able to load a list of source files before giving the hand to the
    > keyboard : I use GNU readline/history library that returns the line
    > input string that could be converted into a stream by std::istrstream.
    >
    > My aim is to cut the interpreter from this input system by feeding it
    > with a unique input stream.


    I've have the interpreter use an input iterator, and
    create a custom iterator that reads from some current
    stream, and switches to a different stream when needed.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
     
    Jerry Coffin, Jun 21, 2006
    #2
    1. Advertising

  3. Guest

    A week later...

    Apologize, my 56k modem was actually destroyed wednesday by a flash
    lightning. It happens.

    I've followed your adviice, Jerry : implemented in switching like you
    said.

    Thanx Jerry !
     
    , Jun 26, 2006
    #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. neele
    Replies:
    0
    Views:
    344
    neele
    May 14, 2004
  2. Casper B
    Replies:
    3
    Views:
    463
    eranb
    Jan 13, 2005
  3. Replies:
    9
    Views:
    676
    Alex Buell
    Apr 27, 2006
  4. Kashif Ur Rehman
    Replies:
    2
    Views:
    899
    Tom Hawtin
    May 17, 2007
  5. et

    Binding a grid to various sources.

    et, Apr 14, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    139
Loading...

Share This Page