Code Competitions

Coding competition

Monday, 27 May 2013

program to update the contents of file

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
    FILE *fp;
    clrscr();
    fp=fopen("ab","w+");
    char ch;
    while((ch=getchar())!=EOF)
    {
        putc(ch,fp);
    }
    cout<<"the entered list is \n";
    fflush(fp);
    fseek(fp,0L,0);
    while((ch=getc(fp))!=EOF)
    {
        cout<<ch;
    }
    fclose(fp);
    getch();
}

OUTPUT:

                   
































1 comment:

  1. very good to get more knowledge about c++ concepts.keep it up

    ReplyDelete