Tengo un problema con este programa. Como podéis ver cuando muestro los registros del fichero los duplica.
Código
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MemoryManager.h"
#define N 80
#define SALIR 4
typedef struct {
char nombre[N];
char direccion[N];
int telefono;
} t_persona;
int menu(void);
void crearFichero(FILE **pf);
void introducirRegistros(FILE *pf);
void visualizarFichero(FILE *pf);
/**
* Punto de entrada y salida al programa principal
*/
int main()
{
int op = 0;
FILE *pf = NULL;
do {
op = menu();
switch (op)
{
case 1: // crear fichero
crearFichero(&pf);
break;
case 2: // introducir registros
introducirRegistros(pf);
break;
case 3: // visualizar registros
visualizarFichero(pf);
break;
case 4: // salir
break;
}
} while (op != SALIR);
MemoryManager_DumpMemoryLeaks();
return 0;
}
{
const int dsp = 'a' - 'A';
if (c >= 'A' && c <= 'Z')
return c + dsp;
return c;
}
int menu(void)
{
int op = 0;
char linea[N] = { 0 };
do {
} while (op < 1 || op > 4);
return op;
}
void crearFichero(FILE **pf)
{
char nomFichero[N] = { 0 };
char resp = 0;
char linea[N] = { 0 };
if (*pf != NULL) {
// existe, preguntar si se sobreesribe
do {
return;
}
}
void introducirRegistros(FILE *pf)
{
char resp = 0;
char linea[N] = { 0 };
if (p_per == NULL)
{
}
do {
do {
}
void visualizarFichero(FILE *pf)
{
char linea[N] = { 0 };
int pos = 0;
if (p_per == NULL)
{
}
}
}
Código:
1. Crear fichero
2. Introducir registros
3. visualizar registros
4. salir
opcion: 1
Nombre del fichero: red.datos
1. Crear fichero
2. Introducir registros
3. visualizar registros
4. salir
opcion: 2
------
Nombre: Marina
Direccion: vereda
Telefono: 234
Desea introducir otro registro: n
1. Crear fichero
2. Introducir registros
3. visualizar registros
4. salir
opcion: 3
Marina
vereda
234
Marina
vereda
234
Gracias anticipadas.
Un cordial saludo


 
  




 Autor
 Autor
		


 En línea
									En línea
								
 
						
