Click to See Complete Forum and Search --> : Input
Ok, im using Borlands Turbo C and im new. What kind of line do i put in to let the keyboard input a string?
Jeremy Martin
May 31st, 2000, 12:47 PM
I sent you a mail attatchment with a small program in it.
Jeremy :)
You can't get a string,persay,from the command line.
What you can get is a character array, so,
do the following
char buffer[256]; //or however long you expect input to be
cout << "Enter something..";
cin >> buffer;
cout << buffer;
cout.flush();
/*
do whatever else you need to do
*/
As far as the string is concerned you can #include<cstring.h>
and then use
string buffer;
and use something like buffer.length() and buffer.get_at(3)
and so on.
If you use the string object you can't do
cout << buffer;
or cin >> buffer;
unless you convert the buffer variable to a cstring,
check your documentation for details.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.