-3

I have a function getToken, I want to pass it an istream to read from and use it. Here is given code. Please help me understand how to work with the istream pointer when passed as parameter.

Token getToken(istream *br, string& lexeme){
    return DONE;//ignore this statement, its part of my needs for istream
}
frasnian
  • 1,893
  • 1
  • 12
  • 24
  • 4
    Why not pass a reference to an `istream`? `Token getToken(istream& br, string& lexeme)` – Jamerson Mar 05 '15 at 03:44
  • 1
    +1 on Frank's comment - a reference might make more sense. Also, what do you mean by "work with the istream"? If you could be more specific about what you need to do and what is not working, it would improve your chances of getting an answer that might help you. – frasnian Mar 05 '15 at 03:47

1 Answers1

3

You can use it just like any other pointer in C++. For example:

char c;    
*br >> c;

or

char c;
br->get(c);
Jamerson
  • 444
  • 2
  • 14