|
Now why would you want to use strcat?? This routine you have now is quite slow reading on a character base is too slow. Use fread and fwrite.
strcat useage is as follows:
...
char dest[20];
dest[0]='\';
strcat(dest,"this is a ");
//now dest="this is a\0"
strcat(dest,"test");
//now dest="this is a test\0"
strcat(dest,"123456789012345678901234567890");
//now you get a crash because your dest string overflows, so this is a buffer overflow.
Easier loop:
char buffer[1024];
...
while !feof(in){
nrbytes=fread(buffer,1,1024,in);
if (nrbytes) fwrite(buffer,1,nrbytes,out);
}
etc..
Backupping files can be done faster using windows functions if yer running windoze.
|