i really don't know how to use text file i i want to know the step by step procedure...
please thank you very much..

#include <fstream>

using std::ifstream;
char line[100];

void read(char* filename){

ifstream file;


int main(){

return 1;

If you wish to open a file for reading. You could code the following:

#include <stdio.h>


    FILE * myfileptr; // a pointer declared to the file stream.
    char sc; // a character which will be input from the file.
    // main code...
    myfileptr=fopen("fileiotst.c","r"); //open the file hopefully
    while((sc=getc(myfileptr))!=EOF) //get a char

        if(sc)printf("%c",sc); //dump it to screen



Note: this procedure reads from the file character by character... if you wanted to read into a string variable you could build up a string from the characters, halting the build on the line end.

Or, if you knew the format of the file (ideally because you built it) you could use fscanf to read in the data. fscanf is the cousin of scanf which we are all familiar with.