Duda de una linia de un exer. ficheros
Publicado por raul (1 intervención) el 02/06/2006 00:12:56
Que hace la linia marcada, pq si la saco funciona igual, no la entiendo
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
void main() {
FILE *f;
char c,cn;
clrscr();
if((f=fopen("prova.dat","w"))==NULL)
{
printf("Error");
getch();
exit(0);
}
do
{
do
{
c=getchar();
fputc(c,f);
}while(c!='.');
printf("Quiere introducir otro nombre?s/n ");
fflush(stdin);
scanf("%c",&cn);
}while(cn!='n');
fclose(f);
if((f=fopen("prova.dat","r"))==NULL)
{
printf("Error");
getch();
exit(0);
}
do
{
c=fgetc(f);
if(c=='.') c=' '; <<<<<<<<<<<<<<<<<<<<<<<<
printf("%c",c);
}while(c!=EOF);
fclose(f);
getch();
}
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
void main() {
FILE *f;
char c,cn;
clrscr();
if((f=fopen("prova.dat","w"))==NULL)
{
printf("Error");
getch();
exit(0);
}
do
{
do
{
c=getchar();
fputc(c,f);
}while(c!='.');
printf("Quiere introducir otro nombre?s/n ");
fflush(stdin);
scanf("%c",&cn);
}while(cn!='n');
fclose(f);
if((f=fopen("prova.dat","r"))==NULL)
{
printf("Error");
getch();
exit(0);
}
do
{
c=fgetc(f);
if(c=='.') c=' '; <<<<<<<<<<<<<<<<<<<<<<<<
printf("%c",c);
}while(c!=EOF);
fclose(f);
getch();
}
Valora esta pregunta


0