conibo Posted August 4, 2013 Share Posted August 4, 2013 (edited) I need help optimizing the following code. while ((chr(onebyte)<>somechar) and not (endoffile(source))) do begin writefilebyte(dest,onebyte); readfilebyte(source,onebyte); end; This goes well below 1kB/minute. I know several other ways to achieve the same effect, but I'm curious about this one. EDIT: Nevermind, the code is fast enough. There was a mistake elsewhere in the program. Edited August 6, 2013 by conibo Quote Link to comment Share on other sites More sharing options...
FHannes Posted August 6, 2013 Share Posted August 6, 2013 Why don't you read the first file into a buffer string, filter out the character and then write the whole string to a file? Would be a lot more efficient than the byte-by-byte approach you're currently employing. Quote Link to comment Share on other sites More sharing options...