Getting a line of text in Dev-C++

This is a discussion on Getting a line of text in Dev-C++ within the C++ Programming forums, part of the General Programming Boards category; It seems that cin.getline is unrecognized in Dev-C++ is there some other function I can use? I haven't tried fgets() ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    4

    Getting a line of text in Dev-C++

    It seems that cin.getline is unrecognized in Dev-C++ is there some other function I can use?

    I haven't tried fgets() since I want to stick to the C++ style.

    Thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Dev-C++ recognizes cin.getline just fine (though the global getline and std::string would be better). What's your code?

    One thing you'll learn is that when it doesn't work, the problem is in 99.9% of the cases you. Especially if you don't use VC++6.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    29
    http://www.cppreference.com/cppstring/getline.html

    Code:
    #include <iostream>
    
    int main()
    {
    	
    	std::string buffer;
    	
    	while (buffer != "QUIT")
    	{
    		std::getline(std::cin,buffer);
    		std::cout << "You wrote: " << buffer << std::endl;	
    	}
    	
    	return 0;
    }
    Last edited by rainmanddw; 01-22-2006 at 08:39 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading text file by line number
    By whiskedaway in forum C++ Programming
    Replies: 13
    Last Post: 06-16-2009, 11:09 AM
  2. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 01:23 AM
  3. Is there any way to read a line from a text file?
    By megareix in forum C Programming
    Replies: 13
    Last Post: 01-09-2009, 01:13 PM
  4. How do I make my edit box move text to the next line?
    By ElWhapo in forum Windows Programming
    Replies: 2
    Last Post: 01-04-2005, 11:21 PM
  5. inputting line of text vs. integers in STACK
    By sballew in forum C Programming
    Replies: 17
    Last Post: 11-27-2001, 11:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21