Thread: using stream&

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    15

    using stream&

    Here is what I am doing:

    Code:
    bool report(stream&,bool,int,int,int);
    The problem I am getting with this code is related to the "stream&" I am using. For this I want to be able to get a stream and be able to write with it. I want to use just stream& because that will allow me to also use the cout command as well. I want to be able to write to a file as well as use cout for testing.

    The Error I am getting is:

    Code:
    20  expected `;' before '(' token
    Does anyone have any ideas here?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 20 expected `;' before '(' token
    Maybe look for a missing ; on the previous few lines?

    Missing one off the end of a class declaration is one common thing people do.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    15
    Quote Originally Posted by Salem
    Maybe look for a missing ; on the previous few lines?

    Missing one off the end of a class declaration is one common thing people do.
    I checked that and there is nothing else wrong. I also just commented out those 2 lines of code and the program compiled just fine. So, it has something to do with those lines.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Show us the few previous line of code before that function declaration.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    There is no such class as stream, is there? Did you mean ostream (or rather std::ostream)? If you want to write out to cout and to a filestream, ostream is what you want.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Yeah, I thought that stream was always qualified with i, o, io, f, etc etc
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    15
    Quote Originally Posted by Salem
    Yeah, I thought that stream was always qualified with i, o, io, f, etc etc

    Yes. I looked into it more and I am not using ostream. Thanks for the help.

Popular pages Recent additions subscribe to a feed