   fstream.h problems
  I'm currently still trying to get down a few things with c++, and IO is one of them.  I have the tutorial found on game dev saved onto my computer so that i may study it, but I'm having errors when I use the fstream.h file.This is the error I get.  I have only included <fstream.h> no iostream.  I'm trying to follow the tutorial that is on game dev.2 C:\Dev-Cpp\include\c++\backward\backward_warning.h:32#warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.I think there is something wrong with the fstream.h file itself.  Please if anyone else is having or has had this problem, can you tell me what is wrong?   
  Which tutorial?  It would appear that it is incorrect.Quote:Misquote from the film The MatrixThere is no <fstream.h>It's <fstream>.  You'll also probably have issues with namespaces.  Might be time to find another tutorial, or head over to the For Beginners forum and check the stickies for the recently started C++ teaching (requires you to obtain a textbook).Σnigma   ;  http://www.gamedev.net/reference/articles/article1127.asp thats the tutorial.   ;  Yeah, look like it's based on pre-standard C++ (over eight years old).  Best advice is to skip it and find another tutorial.Σnigma   ;  Ah thanks.  I have good news though.  My friend looked at the code and just added the iostream file to it and using namespace std; and it works now.  Still not sure what was screwing up but I think including the iostream file fixed it.Thanks for the response.=)   (I can't wait to get started using files!! ^.^)   ;  From the C++ FAQ Lite: What's the difference between <xxx> and <xxx.h> headers?You probably want to be using a more recent tutorial like this or this.   ;  I got IO working in my program, but when I try to store strings into a file, if they contain spaces, it only stores the first word.  I know about getline when your reading a file.  The user is inputting a string into a variable.  The variable will then be written to the outside file.  But when there are spaces, the sentence is not put in there  because there are spaces.  What can I do to fix this?   ;Quote:Original post by SonicD007I got IO working in my program, but when I try to store strings into a file, if they contain spaces, it only stores the first word.  I know about getline when your reading a file.  The user is inputting a string into a variable.  The variable will then be written to the outside file.  But when there are spaces, the sentence is not put in there  because there are spaces.  What can I do to fix this?There are two functions named getline, and they do very different things. Sort of.std::istream::getline is a member of istream, as the name indicates, and reads data into a character array. std::getline is a member of the std namespace, and reads data into a std::string. std::getline is cleaner and easier to use:#include <iostream>#include <string>int main(){  using namespace std;  string line;  cout << "Enter a line of text. Feel free to include spaces, and don't worry about length\n> ";  getline(cin, line);  cout << "The text you entered appears below:\n\n" << line << endl;  return 0;}Use std::getline and std::string. Because std::ifstream derives from std::istream, std::getline can be used on ifstream instances, too - you can use it to read from files.   