www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/08/03:20:47

From: "Mostyn Lee" <mostyn AT ibc DOT com DOT au DOT SPAM>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
References: <f6Yt5.55$t42 DOT 3484 AT nsw DOT nnrp DOT telstra DOT net> <4j%t5.6782$vo6 DOT 96767 AT news2-win DOT server DOT ntlworld DOT com>
Subject: Re: passing istringstream as istream in param
Lines: 77
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <UX%t5.105$t42.4862@nsw.nnrp.telstra.net>
Date: Fri, 8 Sep 2000 14:47:08 +0800
NNTP-Posting-Host: 203.24.93.75
X-Complaints-To: abuse AT telstra DOT net
X-Trace: nsw.nnrp.telstra.net 968395636 203.24.93.75 (Fri, 08 Sep 2000 17:47:16 EST)
NNTP-Posting-Date: Fri, 08 Sep 2000 17:47:16 EST
Organization: Customer of Telstra Big Pond Direct
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

thanks john, but i think you misunderstand my problem, which is not with the
generated code, merely with the interface to that code.  I cant get my
character string in the form of istream * for the lexer to do its parse.


John Harrison <jahhaj AT bigfoot DOT com> wrote in message
news:4j%t5.6782$vo6 DOT 96767 AT news2-win DOT server DOT ntlworld DOT com...
>
> "Mostyn Lee" <mostyn AT ibc DOT com DOT au DOT SPAM> wrote in message
> news:f6Yt5.55$t42 DOT 3484 AT nsw DOT nnrp DOT telstra DOT net...
> > i used flex to generate a parser c++ class, and this class requires a
> > istream * as its parameter
> >
> > yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
> >
> > i need to parse from a character buffer, and have created a
istringstream.
> > the object will not accept the istringstream as a valid type parameter.
> > i am using visual c++ 6.0 with a GNU flex generated class
> >
> >
> > #include <iostream>
> > #include <string>
> > #include <sstream>
> > // ....
> > using namespace std;
> > // ....
> >
> >   string constructstring = ReturnsAString();
> >   istringstream lexingstream(constructstring);
> >   lexingstream << constructstring;
> >
> >    yyFlexLexer myyyFlexLexer(&lexingstream, std::cout);
> > // ....
> >
> > gets the error :
> > error C2664: '__thiscall yyFlexLexer::yyFlexLexer(class istream *,class
> > ostream *)' : cannot convert parameter 1 from 'class
> > std::basic_istream<char,struct std::char_traits<char> > *' to 'class
> istream
> > *'
> >
> > i have tried several things
> > : i have tried to declare a istream to copy the data into, but i always
> get
> > an "ambiguous symbol `istream` " error
> > : i have tried using various `using` and direct (std::istream) methods,
> but
> > all have errors
> >
> > do I need some sort of casting?
> > am I #including something wrong?
> > why cant I just declare,
> >         istream streamname;
>
> I'd guess that your flex generated files are using the old style iostream
> library. Take a look in the generated files and if you see
>
> #include <iostream.h>
>
> replace it with
>
> #include <iostream>    // no .h
> using namespace std;
>
> In Visual C++ the non-standard <iostream.h> and the standard <iostream>
are
> not identical so you may find that you have to do a little more tweaking
of
> the code.
>
> john
>
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019