dartei kopieren
-
ich bins schon wieder .. aber irgendwie ist im mom der wurm drinn
folgendes problem:
- das programm kopiert eine datei nicht komplett sondern nur bis zu einer bestimmten stelle und sagt dann aber das die datei fertig kopiert wurde
- folglich bekommt die variable end den wert 0 viel zu früh .
- vieleicht kann mir ja einer sagen was ich falsch gemacht habe.//--------------------------------------------------------------// // name: bool = copyfile (char* cSourcePath, char* cDestinationPath, MSG* message) // info: kopiert ein file von a nach b und bricht den kopiervorgang // bei beendigung des progs ab. wenn das file vorhanden -> resume // // cSourcePath : quell-pfad // cDestinationPath : ziel-pfad // message : windows message //--------------------------------------------------------------// int copyfile (char* cpSourcePath, char* cpDestinationPath, MSG* Message) { FILE *fileSource, *fileDestination; char temp; int complete, end; size_t sizeChar = sizeof(char); end = 1; fileSource = fopen (cpSourcePath, "r"); fileDestination = fopen (cpDestinationPath, "a"); if (fileSource != NULL && fileDestination != NULL) { fseek(fileSource, ftell(fileDestination),SEEK_SET); end = fread (&temp, sizeChar, 1, fileSource); while (end != NULL && Message -> message != WM_QUIT) { fwrite (&temp, sizeChar, 1, fileDestination); end = fread (&temp, sizeChar, 1, fileSource); } } fclose (fileSource); fclose (fileDestination); if (end == NULL) // wenn datei fertig kopiert wurde { MessageBox (NULL, "fertig kopiert", "Taskbar Icon", NULL); return true; } else { MessageBox (NULL, "nicht fertig kopiert", "Taskbar Icon", NULL); return false; } }
hoffe ich nerv euch nicht schon inzwischen
-
Ab nach C oder WinAPI