Networking, Programming and Graphics Tutorials

Opening files using open - C++ [1/1]

Type:
Opening files using open - C++
Level: Intermediate Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
Opening files using open - C++
Date: 2006-Dec-12
Opening files using open - C++
Visited: 1471 times
Opening files using open - C++
Rating: Opening files using open - C++
Opening files using open - C++
Author: Alex Plumpton

For the file opening, a file stream must be create and then it should be linked to the filename. The file stream can be defined using the classes ifstream ofstream and fstream that are contained in the header file fstream.h. The class to be used depends up on the purpose, that is whether the file is opened for reading or writing data. A file can be opened in two ways. Using the constructor function of the class. Using the member function open() of the class.

Example

ofstream outfile
;                  // create stream (for output)
outfile.open ("file 1")              // connect stream to file 1
outfile.close();                     //Disconnect stream from file 1
outfile.open ("file2")              //Connect stream to file2
outfile.close();                     //Disconnect stream from file2
Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Opening files using open - C++ [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: windows "opening files" C++  c++ open multiple files on linux  how do i open multiple files+unix  how to force html to open .rdp files using mstsc.exe  open multiple files from a unix script  opening webcam in trillian  opening folders using dos commands  dos command for opening remote desktop  Open C++  file* open c++  ftp open parameters  open file with parameter c++  ccproxy open port  open folder in ftp mput  open remote folder with php  open port for trillion webcam  view open connections to server  view open server connections  Server and Viewing Open Connections  view open connections on server