LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-02-2006, 07:14 AM   #1
Kenji Miyamoto
Member
 
Registered: Dec 2004
Distribution: Mandrake 10.1; Fedora Core 3; FreeBSD 5.3; Slackware 10.1 (2.6.10);
Posts: 234

Rep: Reputation: 30
Getting Input from User into Glibmm


How would I properly store user input into a Glib::ustring? std::cin >> input; terminates after the first space, and I must store everything until a newline.
 
Old 04-02-2006, 01:46 PM   #2
spark.ty
LQ Newbie
 
Registered: Apr 2006
Distribution: gentoo
Posts: 3

Rep: Reputation: 0
Try cin.getline(input,n), where n is a number of characters, which will be read but it will also stop reading if a '\n' appear in the buffer.
 
Old 04-02-2006, 06:12 PM   #3
Kenji Miyamoto
Member
 
Registered: Dec 2004
Distribution: Mandrake 10.1; Fedora Core 3; FreeBSD 5.3; Slackware 10.1 (2.6.10);
Posts: 234

Original Poster
Rep: Reputation: 30
Using this returns the following error, meaning that getline cannot be used with Glib::ustring:
Code:
args-cpp.cpp:19: error: no matching function for call to `std::basic_istream<char, std::char_traits<char> >::getline(Glib::ustring&, int)'
/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3/bits/istream.tcc:582: note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(_CharT*, std::streamsize, _CharT) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3/istream:401: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(_CharT*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
glibmm-2.4.0 paul62 Linux - Software 0 10-03-2004 11:22 PM
validating user input blanks Programming 3 09-02-2004 03:47 PM
Got a problem compiling glibmm-2.4.0 Adan Linux - Software 2 09-02-2004 06:13 AM
problem installing glibmm-2.4.0 PierrePau Linux - Software 0 06-02-2004 05:41 PM
glibmm problem zmieff Linux - Newbie 1 05-10-2004 02:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration