cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
question about getchar()
question about getchar()
Jan 6, 2012 at 6:28pm UTC
yyoni69
(27)
hi
maybe someone can help me
i want to use while loop until EOF to get characters
but in the same time to find if there is sequence like "word" in the text that entered
while(c=getchar() != EOF)
{
how can i find the sequence of characters?
Jan 6, 2012 at 8:17pm UTC
Lynx876
(742)
You could use
getline( file, input,
'\n'
);
.
Save to a string and then do a check on it.
1
2
if
( input ==
"word"
)
/* code */
'\n'
is a newline character.
Jan 6, 2012 at 9:34pm UTC
yyoni69
(27)
ok i will try your advice
i have a test this sunday and i try to solve some exrecises hope i secceed
thank you !!
Jan 6, 2012 at 9:37pm UTC
yyoni69
(27)
did you mean to c language not c++ right?
Jan 6, 2012 at 9:39pm UTC
BrokenSilenceDev
(99)
It looks like C++ to me.
Jan 6, 2012 at 9:53pm UTC
Lynx876
(742)
Ahh sorry, that was c++. Being a c++ forum and all... lol
Topic archived. No new replies allowed.