Re: Input strings


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by jay on July 21, 1999 at 20:06:42:

In Reply to: Input strings posted by little me on July 21, 1999 at 18:46:08:

: Okay, I am really starting to get frustrated....
: I want to read a character string from the input line
: so this is the code I wrote:

: char *string;
: cin >> string;

: then to make sure it read in the string correctly
: i added

: cout << string;

: and that is when the progam crashes. I know I am
: doing something wrong, but I just can't see it

: Please help

you have to allocate space for the string, you just declared a pointer. try

char* var=new char[size];

-Jay




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]