Necesito consejo sobre varios errores en el siguiente código
Me salen varios errores..a ver si me los puedes encontrar y areglar!!
Gracias!!
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
struct archi{
int segsocial;
int aux;
char nombre[30];
char apellido[30];}trabajador;
void write_info(void);
void read_info(void);
void main()
{
char c;
struct archi archive;
clrscr();
int done=0;
while(!done)
{
puts("\n archdisco portafolio\n");
puts("A - add news archdisco\n");
puts("L -List archdisco \n");
puts("Q - Quit n");
printf(" Your choice:");
c=getch();
c=toupper(c);
switch(c)
{
case('A'):
puts("Add New archdisco \n");
write_info();
break;
case('L'):
puts("List archdisco \n");
read_info();
break;
case ('Q'):
puts ("Quit \n");
done =1;
break;
default:
puts("?");
break;
}
}
}
void write_info(void)
{
//creando y cerrando el archivo en disco
FILE *archdisco;
archdisco = fopen("c:\\nombre.dat","w");
fclose(archdisco);
getchar();
}
void read_info()
{
struct archi archive;
FILE *archdisco;struct archdisco_data;
int x ;
unsigned c;
archdisco = fopen("archdisco .dat","r");
if (archdisco == NULL)
{
puts("Nodatainfile");
return ;
}
while(1){
c=fread (&archdisco, sizeof (archdisco),1,archdisco);
if (x==0)break;
printf("\n archdisco name :%s\n",archdisco.name);
printf("\n purchased for :%.2\n",archdisco.direccion);
printf("\n:%2\n",archdisco.segurosocial);
}
fclose(archdisco);
}
Gracias!!
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
struct archi{
int segsocial;
int aux;
char nombre[30];
char apellido[30];}trabajador;
void write_info(void);
void read_info(void);
void main()
{
char c;
struct archi archive;
clrscr();
int done=0;
while(!done)
{
puts("\n archdisco portafolio\n");
puts("A - add news archdisco\n");
puts("L -List archdisco \n");
puts("Q - Quit n");
printf(" Your choice:");
c=getch();
c=toupper(c);
switch(c)
{
case('A'):
puts("Add New archdisco \n");
write_info();
break;
case('L'):
puts("List archdisco \n");
read_info();
break;
case ('Q'):
puts ("Quit \n");
done =1;
break;
default:
puts("?");
break;
}
}
}
void write_info(void)
{
//creando y cerrando el archivo en disco
FILE *archdisco;
archdisco = fopen("c:\\nombre.dat","w");
fclose(archdisco);
getchar();
}
void read_info()
{
struct archi archive;
FILE *archdisco;struct archdisco_data;
int x ;
unsigned c;
archdisco = fopen("archdisco .dat","r");
if (archdisco == NULL)
{
puts("Nodatainfile");
return ;
}
while(1){
c=fread (&archdisco, sizeof (archdisco),1,archdisco);
if (x==0)break;
printf("\n archdisco name :%s\n",archdisco.name);
printf("\n purchased for :%.2\n",archdisco.direccion);
printf("\n:%2\n",archdisco.segurosocial);
}
fclose(archdisco);
}
1 Respuesta
Respuesta de victor46
1