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

How to get the index of the clicked field in reports in ABAP?

1270


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

2910


Which language they use during interview?

1611


< DL Compact > tag is used for

1644


could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?

1382






hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com

1577


Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

687


how can we implement locks in plsql?

1917


in IBM PC -AT.WAT AT REFERS TO?

1520


Define Form modules, Class modules and Standard modules

1600


can we extend a class having only one parameterised constructor.Suggest the process to do it.

2143


WHAT IS MAIN IMPORTANT THING IN SOFTWARE?

1828


In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.

1928


What's the difference b/w Table & Templete in Smartform?

1733


how does database connection using ADO.NET?

1625