You are here:

C++/C++ word validation


hey Eddie:
        I facing a problem how to validate text from file. For example: one line in the file is " $%^& we have to go now". How can i filter all those invalid signal and only take "we have to go now".


I know the quick and easy way to do this one. Open the file with a FILE pointer. Read all the contents into a temporary char buffer with fread. Then, use a function called strtok. it takes in the buffer for the first argument and all the delimiters you want to skip and returns a char* to the text after the delimiters specified. Here is some pseudo-code.

open the file
fread(buffer, all information)

strtok(buffer, $%^&);

Catch the return value and you will be good to go.

I hope this information was useful.
- Eddie  


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 All rights reserved.