Come mai non mi copia correttamente i/il file ???
Questa funzione prende in input la lista di file e li apre uno a uno...
I File vanno scritti uno di seguito all'altro nel file INST_FILE_TMP...
codice:#define INST_FILE_TMP "tmpnstll.exe" #define DIM_BUF 11 void save_file (struct fileList *p) { char buffer[DIM_BUF]; FILE *fp; FILE *ifp; ifp = fopen (INST_FILE_TMP, "wb"); while (p != NULL) { fp = fopen (p->inf, "rb"); if (fp != NULL) { while (!feof(fp)) { bar_install(); fread (buffer, sizeof(char), 100, fp); fwrite (buffer, sizeof(char), 100, ifp); fflush (fp); sleep(100); } fclose (fp); } else { /* File Inesistente o Impossibile Aprirlo */ } p = p->pun; } fclose (ifp); };
L'inserimento nella lista l'ho fatto cosi' e non da problemi
codice:struct fileList *request_file_list(void) { struct fileList *p, *paus; unsigned int i, n; printf ("\nQuanti File Ha il Tuo Progetto ? # "); scanf ("%u", &n); getchar(); if (n==0) { p = NULL; } else { p = (struct fileList *) malloc (sizeof(struct fileList *)); printf ("\nFile 1 # "); gets (p->inf); paus = p; for (i=2; i <= n; i++) { paus->pun = (struct fileList *) malloc (sizeof(struct fileList *)); paus = paus->pun; printf ("File %d # ", i); gets (paus->inf); } paus->pun = NULL; } return (p); };

Rispondi quotando

