Hi, i need to search for a string in a file. I am trying to use memcmp() but i have never used this before and have no idea how it works. Looking at its description it compares 2 blocks of memory but im not sure this is what i want to search for a string in a file. I have also found memchr() but this searches for a character not a string. Can anyone help me out by pointing me in the right direction?
tootypegs
0
Junior Poster in Training
Recommended Answers
Jump to PostNeither of those functions will be useful to you. This is a c++ program, right? Then just use std::string's find() method after reading a line from the file
Here is a complet …
All 3 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
tootypegs
0
Junior Poster in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.