Menu

cin.get

2002-08-14
2012-09-26
  • Nobody/Anonymous

    I got this example from "Sam's teach yourself c++ in 21 days" and it doesnt work on Dev-C++.  I've tryed evrything and the only way i can get it to work is by adding the third parameter in cin.get (which by the way every char works except for '\n')
    Can anyone Please help?

    <<<<<<<<<<CODE<<<<<<<<<<
      char buffer[80];
      cout << "Enter the string: ";
      cin.get(buffer, 79);     // get up to 79 or newline
      cout << "Here's the buffer:  " << buffer << endl;
    <<<<<<<<<<CODE<<<<<<<<<<

     
    • Nobody/Anonymous

      hmmm...
      This code seems to work fine for me.  Try this:
      Tools -> Check for Updates/Packages
      <click start>
      see if there is a new version of the main executable for the IDE.  Make sure that your copy of MinGW is up to date as well.

      Might also see if you have a memory leak earlier in your program.  This can cause wierd errors like this one.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.