Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-28-2006, 06:05
piccolo piccolo is offline
Friend
 
Join Date: Jul 2006
Posts: 28
Rept. Given: 4
Rept. Rcvd 3 Times in 1 Post
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
piccolo Reputation: 3
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.
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT +8. The time now is 04:01.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )