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

Assignment Help:

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;

 

}


Related Discussions:- Program to open a file in c++

What is memory allocation, What is memory allocation? Memory Allocation...

What is memory allocation? Memory Allocation : It is the method of allocating memory storage to program in such that the program can be run.

Socket Programming, Need someone to look over my assignment for correctness...

Need someone to look over my assignment for correctness and make any necessary changes.

#palindrome, replace character into string and return value of string that ...

replace character into string and return value of string that are replaced

Differences between a pointer and a reference, Differences between a pointe...

Differences between a pointer and a reference 1.  A reference must always point to some object where as this restriction is not imposed on a pointer. e.g. int *pi = 0;

What do you meant by linear search, Question : (a) One of the most co...

Question : (a) One of the most common sorting techniques we have in programming is the ‘Bubble Sort'. This technique will be used to sort an array of elements in ascending or

Decodethecode, decode smugglers are very smart in day by day

decode smugglers are very smart in day by day

Queue, program to enter 5 values in queue and remove value one by one from ...

program to enter 5 values in queue and remove value one by one from queue.

Static data meber and const data meber, can we use const data member in sta...

can we use const data member in static. member function with example.

Illustration of grid function, Illustration of Grid function: For illu...

Illustration of Grid function: For illustration, the script below creates two individual figure windows. At First, it clears the figure window. Then, it generates an x vector

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd