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

Tell me the jobs for the MCA Fresher in delhi, Noida..

0 Answers  


What is the purpose of <Trigger> element of <updatePanel> in Ajax

0 Answers  


WHAT IS NV RAM ?

3 Answers  


Is the IT field raise again? What is the position of IT after 4 years?

0 Answers  


write a query that returns one row for each department and the number of employees in that department. Given two tables EMPLOYEE and DEPARTMENT, where there can be multiple employees per department.

0 Answers   IBM,






how do find the user exit for selected feild whatis the process and can u plz explain it

0 Answers  


what is the draw back of Power builder

0 Answers   IBM,


Need provab technical test questions

0 Answers  


how CLR identify vb file?

0 Answers   Tech Mahindra,


hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.

0 Answers  


What is the output of the following x = "abcdef" i = "a" for i in x: print(i), a) no output b) i i i i i i … c) a a a a a a … d) a b c d e f

0 Answers   Peerless,


can any method return type may be constructor , or that method name allow

0 Answers   HCL,


Categories