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

What is diffrent between Method and and function in c#

1765


I am looking for NIC Sample papers or any patern of questions/ syllabus plz, send me on hamid.khan135@yahoo.in Regard

1736


What is the Difference between in memory database and physical database

2327


What is the difference beween joblib and steplib statements

2024


Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance

1657


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.

810


Delta 5 weight scale not connect with oracle application what i can do?

2020


For a binary tree with n nodes, How many nodes are there which has got both a parent and a child?

3417


Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?

826


19. Given a system that is described with the following equation, X=A+(B.(A̅+C)+C)+A.B.(D̅+E̅) a) Simplify the equation using Boolean Algebra. b) Implement the original and then the simplified equation with a digital circuit. c) Implement the original and then the simplified equation in ladder logic.

1448


how can i create report in abap to insert data in table pa0002 using insert command

1951


how to work search engine? plz detail answer me.

1673


how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?

2110


3. What is the difference between testing and Quality Assurance?

1693


what is the last ant version you worked?how to get it

1703