| | |
File array question
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2005
Posts: 91
Reputation:
Solved Threads: 0
Hey guys, I have currently used the following code.
and the file contains "hellojames" but it gives the hello word count as 1.
I was just wondering why this happens as shouldn't there be white space for this to happen?
Thanks.
C++ Syntax (Toggle Plain Text)
if(strstr(ch,"hello") != 0)
and the file contains "hellojames" but it gives the hello word count as 1.
I was just wondering why this happens as shouldn't there be white space for this to happen?
Thanks.
Well, "hellojames" definitely contains "hello", so the function faithfully tells you it found it. If you want to look for "hello ", then you may do so.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- reading txt file into array (C++)
- input data from a file into an Array (C)
- reading from file into array (C++)
- Help Reading Info in Text File Into an Array (C++)
Other Threads in the C++ Forum
- Previous Thread: Win32 - Controls on main window
- Next Thread: vector<string> - way to find longest string?
Views: 1974 | Replies: 14
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






