Program to open a file in c++, C/C++ Programming

Program to Open a file in C++:

int main()

{

                 char ch;

                 ifstream f1 ("OLDFILE.TXT");

                 ofstream f2 ("NEWFILE.TXT");

 

                 if (!f1) cerr << "Cannot open OLDFILE.TXT for input";

                 if (!f2) cerr << "Cannot open NEWFILE.TXT for output";

 

                 while (f2 && f1.get(ch))

                                 f2.put(ch);

 

return 0;

 

}

Posted Date: 10/18/2012 9:23:40 AM | Location : United States







Related Discussions:- Program to open a file in c++, Assignment Help, Ask Question on Program to open a file in c++, Get Answer, Expert's Help, Program to open a file in c++ Discussions

Write discussion on Program to open a file in c++
Your posts are moderated
Related Questions
Implement a menu driven real estate catalogue system that allows users to perform various catalogue maintenance and search tasks.  You are only allowed to use the C programming la

how to make the coding

What data structure would you mostly likely see in a nonrecursive implementation of a recursive algorithm?Minimum 100 words accepted#

Array of Objects A class is a template, which can contain data items as well as member functions to operate on the data items. Various objects of the class can also be declared

What is abstraction? - Simplified view of an object in user's language is termed as abstraction. - It's the simplest, well-defined interface to an object in OO and C++ which

i am a engineering student and am working on a project in audio processing and so i have designed a FIR filter in Matlab . how can i get my Matlab program converted to C program?

c program of double linked list with full explanation

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)

L is a text and can be composed of any of the characters {, }, (, ) , and P, where P will represent the instruction. L will contain single spaced characters where each character

i need a detailed c program to explain the parameters of bernoulli''s equation..