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

There is a table which contains all the employee details, unfortunately there is mistake occured while entering the data. ex: ------------------------------- empid empname gender address ------------------------------- 1 abcd f address1 2 defg m address2 3 ghth m address3 4 jkil f address4 write a update query that will change gender 'm' to 'f' and 'f' to 'm'

2 Answers  


Ordered List tag is

1 Answers  


How can successful and thorough systems planning, analysis, and design be ruined by poor systems construction and implementation? How can poor systems analysis or design ruin a smooth construction and implementation? For both questions, list some consequences

1 Answers  


.net 2005 supports how many languages?

4 Answers  


how to work search engine? plz detail answer me.

0 Answers  






What are the compilers of JAVA and .NET Programming languages?

1 Answers   HCL, Microsoft,


is it possible to learn sap from book without any tutorial. if yes please mention the beginner,s book of sap and also make your valuable advice for self study of sap .

0 Answers  


what is the difference between "types" and "data" in abap.

4 Answers   Tech Soft,


HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??

0 Answers  


How many processes can listen on a single TCP/IP port?

3 Answers  


what are the differences between CONS, LIST, and APPEND

0 Answers   Comtech,


5.Call by value and Call by reference with program?

0 Answers  


Categories