Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/12/2010, 17:23
Avatar de Munire
Munire
 
Fecha de Ingreso: julio-2010
Ubicación: en el ciberdespacio (España)
Mensajes: 150
Antigüedad: 13 años, 9 meses
Puntos: 4
Respuesta: Problema ficheros!!!

Código C:
Ver original
  1. char nombre[40];
  2. FILE *pf = NULL;
  3. printf("escribe el nombre del fichero que quieras crear: ");
  4. fflush(stdin);
  5. gets(nombre);
  6. if(nombre[strlen(nombre)-1] == '\n')
  7.     nombre[strlen(nombre-1)] = 0;
  8.  
  9. pf = fopen(nombre, "w");
  10. if(pf == NULL)
  11. {
  12.     printf("Error: el fichero no se puede abrir.\n");
  13. }
  14. fclose(pf);