# Include <fstream. h> method, but fatal errorc1083 is prompted during compilation: The file including "fstream. h ": no such file or directory.
After reading the relevant information, find the solution:
Set
# Include <fstream. h>
Change
# Include <fstream>UsingNamespaceSTD;
Compilation and running are successful ~~~
Why?
Because:
The old iostream library is removed from Visual C ++. NET 2003.
The major difference between the standard C ++ Library and the previous Runtime Library is the iostream library. Iostream implementation
The details have been changed. to link to the Standard C ++ library, it may be necessary to rewrite it.CodeUsing iostream
.
You must remove any old iostream header files (fstream. H, iomanip. H, Ios. h
, Iostream. H, istream. H, ostream. H, streamb. H, and strstrea. H), and add
Or Multiple New Standard C ++ iostream header files (<fstream>, <iomanip>, <IOS>, and <iosfwd>
, <Iostream>, <istream>, <ostream>, <sstream>, <streambuf>, and <strstream>
, All header files do not have the. h extension ).
In the new Standard C ++ iostream Library:
1. The open function does not use the third parameter (Protection parameter ).
2. You cannot create a stream from the file handle.
3. Except for a few exceptions, all the names in the new Standard C ++ library are in the STD namespace. For more information, see use the C ++ library header.
4. The ofstream object cannot be opened with the IOS: Out flag. The IOS: Out sign must be combined with another IOS enumeration number in the logic or. For example, it must be combined with IOS: In or IOS: app.
5. Because the eofbit status is set, no non-zero value is returned for iOS: good after the file is reached. IOS: SETF (_ iflags)
It should not be used with the flag value of IOS: Dec, IOS: Oct, or IOS: Hex. Formatted input/output functions and operators are assumed to have only one base. Use ios_base instead.
For more information about the changes, refer to msdn ~
Except for the above changes, the following functions, constants, and enumerations used as elements of the old iostream library are not new iostreams.
Library element:
Attach Member functions of filebuf, fstream ifstream, and ofstream
FD member functions of filebuf, fstream ifstream, and ofstream
Filebuf: openprot
Filebuf: setmode
IOS: bitalloc
IOS: nocreate
IOS: noreplace
IOS: sync_with_stdio
Streambuf: out_waiting
Streambuf: setbuf (the same behavior uses rdbuf-> pubsetbuf)
From: http://www.cnblogs.com/lingshaohu/archive/2011/11/07/2239453.html