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

3 members in a pf.how we read 3 members without using ovrdbf.using rg pgms....

1935


Given a set. Write the pseudo code to get all the subsets for the given set. Eg. Input : {1,2} Output : (),(1),(2),(1,2)

2484


I want Ada programming language books. Could anyone post me any link for that?

3176


what is client server & server? What r types of Joins? explsin it! which types of indexex in sql server? what is triggers?

1767


the systematic access of small computers in a distributed data processing system is referred as?

2990


which worker is involved in all the phases of SDLC?

1938


As per interoperatbility programs written in one language can be used by other language. How can we restrict the features of one language (say C#) in the programmer written in another language (say VB)..for example we have some features like operator overloading which is possible C#.NET (not in VB.NET), how can we restrict that when we are using this code in VB.NET.

1727


when will triggars the at new event in abap and web dybn pro?

1722


If i have a dataset queried from Sql and I would like to insert the dataset into a specific node in an xml document how do I do this

1912


what is the difference between uservariables and systemvariables (in Environmental variables)???

2221


what is delimiter in sas ?

1804


1. Consider the following input and generate the object code using single pass assembler. JOHN START 0 USING *,15 L 1,FIVE A 1,FOUR ST 1,TEMP FOUR DC F’4’ FIVE DC F’5’ TEMP DS ‘F END

2622


hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad

1617


which book we learned this mantis? how many version are realsed this mantis upto now?

1666


Write a shell program where you enter a number which corresponds to K.M. Find out the corresponding values in m, cm, inches, and feet. Hints:- 1 k.m= 1000 m 1 m= 100 cm 1 inches= 2.54 cm. 1 feet= 12 inches

1769