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



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

Answer / 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

More Programming Languages AllOther Interview Questions

what are the topics choosen for jam round for interviews

0 Answers  


if heap sort contains n elements, no of comparsions required are

2 Answers   Hughes,


why we use static with only main()class not with other class

2 Answers   TCS,


which is the best institute for testing tools in hyderabad?

1 Answers  


I have try to write a record in a TDQ from a fle.... what are the steps to do... can anybody plz come with a solution

0 Answers  






given a height balanced tree. If we add one more node , how many nodes gets unbalanced ?

2 Answers   Hughes,


A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE

7 Answers   Nagarro,


In java without use of main() how to execute the program

0 Answers  


What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

2 Answers  


When we have two versions of the dot net installed how does the compiler know which version of DLL it has to select to an application.

0 Answers   Tesco,


i want to insert textbox value to sql db. i have only one text box but store four values. ple give any one give sample code in asp.net c#..

1 Answers   Concentrix,


why we use abstract in awt?

0 Answers  


Categories