Write a program to read and print a text file on screen

Answer Posted / ashwek

/// Using C++

#include<iostream>
#include<fstream>
#include<stdio.h>

int main(){

char Data[200];
ifstream File("FILE_NAME"); //Opening a File

while(File){ //Run until End of file
File.getline(Data, 200); //Read data from file & store in Data (string)
cout<<Data; //Print data
}
File.close();

return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

any drawback are there in mantis?

1638


Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.

782


what is delegate and delegation model give the real live example on delegate model

2816


design a counter with the following repeated binary sequence: 0, 1, 2, 3, 4, 5, 6, 7, 8 using JK Flip Flop.

16212


How to call a C++ function which is compiled with C++ compiler in C code?

787






how to stop execution of step 3 in a job mainframe

1707


what is the use of occurs 10 or (any number) in the internal table declaration with header line.

1464


How will you prove that java swing is multithreaded?

1694


Difference between delegates and Events?

1703


pleasew define carrier scope in abap (sap).

2100


can u send some model papers how computer awareness questions are asked in goverment jobs(oriental insurance)to my mail id me.priyankapadma@rediff.com

1921


What is SOLID Principle in Programming Language?

654


differences between qtp10.0 and 11.0 ?

1808


how to add a new table with variables and thier values into a imported file uisng proc import?

1442


Have you used callsymputx? what points need to be kept in mind when using it?

1534