Developer community
0 votes
53 views
asked by Geek (15.3k points) 18 43 68 | 53 views

1 Answer

0 votes

#include<stdio.h>

#include<conio.h>

#include<process.h>

void main()

{

FILE *fp;

char c=‟ „;

clrscr();

fp=fopen(“data.txt”, “r+”);

if(fp= = NULL)

{

Printf(“cannot open file”);

exit(1);

}

Printf(“\n Contents read:”);

While(!feof(fp))

Printf(“%c” getc(fp));

Printf(“write data & to stop press „.‟ :”);

while(c=‟!‟)

{

C=getche();

fputc(c,fp);

}

getch();

}

Output:

Contents read: Help me.

Write data & to stop press‟.‟: I am in trouble. 

answered by Guru (39.1k points) 10 22 37

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users