You are not logged in.

  • Login

Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, December 15th 2006, 9:44pm

Dateien kopieren!

Moin, Moin!
Wie kann ich in c++ Dateien von einen in einen anderen Ordner kopieren?

Es wäre super wenn ihr irgendwelche Quelltext hätte, die bräuchte ich dann nur noch anpassen, was logischer Weise am einfachsten für mich ist! *g*

Aber auch der passende Algorhytmus ist willkomen!

Danke im voraus.

mfg

2

Saturday, December 16th 2006, 1:12am

Algorithmus ohne Error-Handling:

C Quellcode

1
2
3
4
5
6
7
8
9
10
11
FILE* fIn = fopen ("file1", "rb");
FILE* fOut = fopen ("file2", "wb");
const int MAX = 4096;
char sBuf[MAX];
int nBytesRead;
while ((nBytesRead = fread (sBuf, 1, MAX, fIn)) > 0)
{
  fwrite (sBuf, 1, nBytesRead, fOut);
}
fclose (fOut);
fclose (fIn);

Viel Erfolg.

Social bookmarks