|
-
October 1st, 2008, 06:34 PM
#1
I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!
Code:
.
.
.
.
int line = 0;
int charLength =0;
char *body[line][charLength];
cout<<"Please enter line of texts. Press Ctrl+D to quit:"<<endl;
cin>>body[line][charLength];
while(*body[line][charLength] != 4)
{
if (*body[line][charLength] == '\n')
{
line++;
charLength++;
cin>>body[line][charLength];
}
else
{
charLength++;
cin>>body[line][charLength];
}
}
This code suppose to read input from keyboard. Reads lines of texts unitl user press CTRL+D
It compiles, i enter characters, press enter ..... I get message says segmentation fault
I tried to fix it, i still get the error message .... Can you help please
Input will look like:
***********************************
hello my name is none ...........
this is a test
GOOD JOB!
***********************************
Can you help plz
Last edited by f.ben.isaac; October 1st, 2008 at 06:39 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|