Sponsored Content
Full Discussion: C++ cin problem
Top Forums Programming C++ cin problem Post 302197337 by WebKruncher on Tuesday 20th of May 2008 09:31:40 PM
Old 05-20-2008
getline

better control of the input is achieved by using getline...

cout<<"Please type something:"<<endl;
string line;
getline(cin,line);
cout<<"You entered:"<<line<<endl;
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

SSH Problem auth problem

Hi, Just recently we seem to be getting the following error message relating to SSH when we run the UNIX script in background mode: warning: You have no controlling tty. Cannot read confirmation.^M warning: Authentication failed.^M Disconnected; key exchange or algorithm negotiation... (1 Reply)
Discussion started by: budrito
1 Replies

2. Programming

How to Get Timed Input using cin

Hi, I am trying to get the input like option from the user using cin but if the user is not responding for some time I want to use the default value which does not need users interaction can any one help to do this in unix c++? int main() { char sex = 'M' ; cout << "Are you... (5 Replies)
Discussion started by: uxbala
5 Replies

3. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

4. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

5. Red Hat

Mail Problem. Maybe, it is a DNS Problem!

Hi, i've a redhat linux 9 upadated by redhat from 7 version to 9 version. A couple of days ago i was a problem with my mail, in other words i'm not able to get any email nor to send any email. I've a proxy configuration and i tried to set iptables in order to verify the port. The 110,255 and 995... (1 Reply)
Discussion started by: pintalgi
1 Replies

6. UNIX for Dummies Questions & Answers

DHCP problem and eth1 problem

At work I am trying to get this one Linux machine (let's call it ctesgm07) to behave like another Linux machine that we have (let's call it test007). test007 returns the following version info: cat /etc/debian_version: lenny/sid uname -a: Linux test007 2.6.27-7-generic #1 SMP Tue Nov 4... (0 Replies)
Discussion started by: sllinux
0 Replies

7. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

8. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
FBB::LocalClientSocket(3bobcat) 			     Unix Domain client Socket				   FBB::LocalClientSocket(3bobcat)

NAME
FBB::LocalClientSocket - Client Socket connecting to a Server in the Unix Domain SYNOPSIS
#include <bobcat/localclientsocket> Linking option: -lbobcat DESCRIPTION
An FBB::LocalClientSocket may be constructed to connect to a server process in the Unix Domain. The socket made available by the FBB:Local- ClientSocket may be used to initialize a std::istream and/or std::ostream. The std::istream is used to read information from the server process to which the FBB::LocalClientSocket connects, The std::ostream is used to send information to the server process to which the FBB::LocalClientSocket connects. Since a socket may be considered a file descriptor the avaiable FBB::IFdStream, FBB::IFdStreamBuf, FBB::OFdStream, and FBB::OFdStreamBuf classes may be used profitably here. Note that having available a socket does not mean that this defines the communication protocol. It is (still) the responsibility of the programmer to comply with an existing protocol or to implement a tailor-made protocol. The latter situation implies that the sequence of input- and output operations is defined by the programmer. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
FBB::LocalSocketBase CONSTRUCTOR
o LocalClientSocket(): This constructor merely creates a FBB::LocalClientSocket object. Before it can be used, its open() member must be called. o LocalClientSocket(std::string const &name): This constructor initializes an FBB::LocalClientSocket object, using the named Unix Domain socket to connect to the server using the named Unix Domain socket. An FBB::Errno is thrown if the socket could not be constructed. The construction of the socket does not mean that a connection has actually been established. In order to connect to the server, the member connect() (see below) should be used. The copy constructor is not available. MEMBER FUNCTION
o int connect(): This member returns a socket that can be used to communicate with the server process. An FBB::Errno exception is thrown if the con- nection could not be established. o open(std::string const &name): This member function prepares the FBB::LocalClientSocket object, constructed earlier using the default constructor, for use. The named Unix Domain socket is used to connect to the server using the named Unix Domain socket. An FBB::Errno is thrown if the socket could not be constructed. The construction of the socket does not mean that a connection has actually been established. In order to connect to the server, the member connect() should be used. EXAMPLE
See also the localserversocket(3bobcat) example. #include <iostream> #include <bobcat/localclientsocket> #include <bobcat/ifdstream> #include <bobcat/ofdstream> using namespace std; using namespace FBB; int main(int argc, char **argv) try { if (argc == 1) { cerr << "Provide filename representing the unix domain socket "; return 1; } LocalClientSocket client(argv[1]); int fd = client.connect(); string line; cout << "Connecting to socket " << fd << endl; IFdStream in(fd); // stream to read from OFdStream out(fd); // stream to write to while (true) { // Ask for a textline, stop if empty / none cout << "? "; if (!getline(cin, line) || line.length() == 0) return 0; cout << "Line read: " << line << endl; // Return the line to the server out << line.c_str() << endl; cout << "wrote line "; // Wait for a reply from the server getline(in, line); cout << "Answer: " << line << endl; } return 0; } catch (Errno const &err) { cerr << err.what() << " " << "Can't connect to " << argv[1] << ", port " << argv[2] << endl; return 1; } FILES
bobcat/localclientsocket - defines the class interface SEE ALSO
bobcat(7), ifdstream(3bobcat), ifdstreambuf(3bobcat), clientsocket(3bobcat), localserversocket(3bobcat), localsocketbase(3bobcat), ofd- stream(3bobcat), ofdstream(3bobcat) BUGS
None Reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::LocalClientSocket(3bobcat)
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy