File Input/Output help

0 Anton Wieslander · May 31, 2015
Hello guys and gals.

  • I am making a program that asks the user for some words stores them in a file. the user then inputs a sentence, and depending on which words he entered in to the file, those words will be censored. Something like a modifiable language filter.

  • I try to practice certain parts of Class/File/Strings.

  • I use a separate class which handles all the stuff to do with File handling.

  • I try to build this program without using "using namespace std;" just for practice purpose

  • The problem I am facing is that when I am trying to write or output from a file
    WordFile << word
    WordFile >> word

  • It doesn't recognise the operators >> or << using operands std::ofstream << std::string

    not sure how to fix it :/

Post a Reply


Oldest  Newest  Rating
0 Anton Wieslander · May 31, 2015
After breaking my head for a good 4 hours yesterday searching for solution.
woke up this morning and noticed that I just forgot to 
#include <string>

go figure...
0 Anton Wieslander · May 31, 2015
Yer I fixed the problem with #include <string> (lack of concentration, im a lazy potato)

I wanna sortof keep bashing my head against this brick wall untill i get it.

Also is there a place where i can learn more advanced stuff about c++?
0 sumeet prasad · June 8, 2015
just to help you 
include<fstream> in your header file.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator