answersLogoWhite

0

You have to use the preprocessor directive fstream.h.

#include <fstream.h>

void main ()

{

ifstream inDataStream;//the stream to open excess to a file

inDataStrea.opem("fileName.txt");//to open an excess to the file fileName.txt (can be //any)

if (inDataStream.fail())//check if the file was opened successfully

{

cout << "Couldn't open the file!";

}

inDataStream << "Hello";// writing the word "Hello" in the file (can be any information)

inDataStream.close();//close the opened excess to the file

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How do you remove a dll file that is open by other programs?

You have to close the other program first, because when a program has a file open, the system locks the file.


What are the three steps that must be taken when a file is used by a program?

1. Open the file, Process the file, Close the file


How can you open a separate program with Batch files and then close that program with Batch?

Batch file that opens a program waits 5 seconds then closes that program. For some reason I cannot get this batch to perform the open portion, wait, then the close portion in .... startup batch file hangs up on second command.


Method 'CopyFile' of object 'IFileSystem3' Failed?

This error is due to the write protection check if the destination file is open. If the file is open close that file, it Will fix the issue.


How to create a batch file and impliment it?

To create a batch file open notepad, textedit, or whatever editor you wish to use. Once open write your program, check for errors, and "make simple text." Save this program as whateveryouwant.bat. Open the file and the batch file will execute.


What is basic structure of file handling in c language?

open, read/write, close


What program can you use to open an abw file?

tinyword.com There, they provide the program needed to open an .ABW file.


How do you open an Alice a2w file?

Open Alice, the program. From there, open it and open an a2w file.


How do you change the priority of a process?

Close the process. Then, re-open it as an application with a batch file: Start "program name" [no extension] /high "Location of Program".


How does one open a 3GP file?

The best way to open a 3GP file is to double click on the file and to let the computer decide what program to use to open it. If your computer cannot open the file, then you will need to download a program that can open this kind of file.


How do you edit a existing file in c program?

Open the file for reading and load the content into memory where it can freely edited. To prevent external changes to the file, keep the file open but lock it to prevent access. When the user saves the modified data, write that data to a temporary file then close it. Then close the original file, delete it and rename the temporary file with the original file name. For added safety during file edits, you should also maintain a recovery file that keeps track of all the changes. Once the temporary is renamed, you can delete the recovery file.


How do you close a computer program?

Click the Close button in the upper-right corner of the window.Click Alt+F4 to close an active open window.Choose File (or application button)&rarr;Exit