![]() |
| | #1 |
| Registered User Join Date: Apr 2007
Posts: 12
| Merge Binary Files |
| chinook86 is offline | |
| | #2 | |
| Registered User Join Date: Sep 2004 Location: California
Posts: 2,845
| Quote:
| |
| bithub is offline | |
| | #3 |
| CSharpener Join Date: Oct 2006
Posts: 5,242
| probably cat works faster because it reads/writes in big chunks
__________________ If I have eight hours for cutting wood, I spend six sharpening my axe. |
| vart is offline | |
| | #4 |
| Registered User Join Date: Jan 2008
Posts: 18
| I think fgets() and fputs() is good for this case. Last edited by invinciblevn; 01-21-2008 at 12:22 AM. |
| invinciblevn is offline | |
| | #6 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| cat _DOES_ fread/fwrite (or some variant thereof) - so, yes, it doesn't make much sense to write your own version of the same functionality. If you still want to do that, use large buffers for the read/write data - 4KB or bigger will be a good start. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #7 |
| and the hat of vanishing Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,214
| A buffer size of BUFSIZ is meant to have pretty good performance characteristics (on average). cat may use the lower level read/write primitives which are a bit closer to the machine than the truly portable fread/fwrite. But you limit yourself to POSIX systems in doing so. You also have to weigh the efficiency of cat with the cost of spawning another process.
__________________ If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. Up to 8Mb PlusNet broadband from only £5.99 a month! |
| Salem is offline | |
| | #8 |
| Registered User Join Date: Apr 2007
Posts: 12
| Thanks for the help guys. This was a programing assignment designed to learn system calls on a unix based system. Therefore, I decided to use the system("cat -u ....") command. |
| chinook86 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| added start menu crashes game | avgprogamerjoe | Game Programming | 6 | 08-29-2007 01:30 PM |
| Copying Binary Files | mikeman118 | C++ Programming | 9 | 08-11-2007 10:55 PM |
| Help with binary files | tuxinator | C Programming | 3 | 12-01-2005 02:11 AM |
| send/recv binary files using sockets in C++ | dafatdude | Networking/Device Communication | 14 | 07-25-2004 11:00 AM |
| Binary files | Brian | C Programming | 2 | 02-18-2002 01:13 PM |