User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,501 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,671 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 13886 | Replies: 15
Reply
Join Date: Apr 2006
Location: Canada
Posts: 4,535
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 283
Moderator
Featured Blogger
John A's Avatar
John A John A is online now Online
Vampirical Moderator

Re: How do I flush the input stream?

  #11  
May 26th, 2008
>Again if anyone knows why I'm getting the compile error posted above when
>using g++ in linux (ubuntu) would you please help me out?

I had nothing better to do, so I decided to screw around with the code Narue posted. You're correct in that g++ gives an error when compiling the 'pause' class. Try renaming the entire 'pause' class to something else, perhaps pause2 (in other words, do an entire find and replace with 'pause'), and it'll compile fine. I asked Narue about this on IRC, and she figured it was probably some gcc/g++ extension that was messing things up (which is obviously the only real possibility here).
Last edited by John A : May 26th, 2008 at 7:52 pm.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Mar 2008
Posts: 22
Reputation: iansane is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
iansane iansane is offline Offline
Newbie Poster

Re: How do I flush the input stream?

  #12  
May 26th, 2008
Thank you John A and Narue.

I never would have thought of something like that since I'm a noob. I don't know enough to decide between windows, linux and the different compilers who is complying with c++ standards and who is not fully compliant. You are a real help.
Thanks for the hard work coding this and thanks for looking into my g++ problem.
Reply With Quote  
Join Date: Dec 2006
Location: india
Posts: 1,085
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Rep Power: 9
Solved Threads: 163
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: How do I flush the input stream?

  #13  
May 27th, 2008
> ...probably some gcc/g++ extension that was messing things up
> (which is obviously the only real possibility here).
it is not some gcc/g++ extension; it is POSIX
man pause http://node1.yo-linux.com/cgi-bin/ma...ommand=pause(2)
Last edited by vijayan121 : May 27th, 2008 at 2:39 am.
Reply With Quote  
Join Date: May 2008
Posts: 349
Reputation: Radical Edward has a spectacular aura about Radical Edward has a spectacular aura about Radical Edward has a spectacular aura about 
Rep Power: 3
Solved Threads: 60
Radical Edward's Avatar
Radical Edward Radical Edward is offline Offline
Posting Whiz

Re: How do I flush the input stream?

  #14  
May 27th, 2008
That's why Edward puts as much code as possible in namespaces. Compilers are bad about including all kinds of unexpected stuff in the standard headers, so even if you don't include unistd.h yourself, iostream or another standard header might do it for you and create a name conflict.
If at first you don't succeed, keep on sucking until you do succeed.
Reply With Quote  
Join Date: Mar 2008
Posts: 22
Reputation: iansane is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
iansane iansane is offline Offline
Newbie Poster

Re: How do I flush the input stream?

  #15  
May 27th, 2008
I can not find unistd.h anywhere on my system.

So let me see if I understand this.

POSIX is the linux API just like there's a Windows API.

By changing pause to pause2, we have something that complies to c++ standards, Windows API standards, and POSIX standards.

Is that how it works? I guess just learning c++ will not be enough if I want to program cross platform?

Is one or the other of the above mentioned not 100% following standards or is that just the way it works?

Sorry so many questions but I don't understand this type of issue yet. Tell me if I'm way off in my way of thinking. Is this even a standards issue or something else?

Thanks
Reply With Quote  
Join Date: Jun 2008
Posts: 19
Reputation: xxxviking is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
xxxviking xxxviking is offline Offline
Newbie Poster

Re: How do I flush the input stream?

  #16  
Jun 13th, 2008
hmm nice topic. i leart the way...thanks to all..
Last edited by Narue : Jun 13th, 2008 at 9:53 am. Reason: Snipped fake signature
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 3:33 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC