Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

urgent: how to concat files in C

hi,

assuming i have file a, b, c and d. is there a faster way to combine these files instead of using, fread file b and write to file a. then, read file c , and write to file a and so on.

in the unix system, we use cat a b c d > newfile. is there a cat function is c ? thanks
Avatar of ravenpl
ravenpl
Flag of Poland image

No,
cat uses almost same algo as You mentioned - opens every file, read and writes to stdout.
ASKER CERTIFIED SOLUTION
Avatar of n2fc
n2fc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zizi21
zizi21

ASKER

"No,
cat uses almost same algo as You mentioned - opens every file, read and writes to stdout."

But does this mean that the cat would use the RAM memory ?
Avatar of zizi21

ASKER

I don't understand. When fread and fwrite is used, you need a buffer. Does this mean that cat doesn't use buffer memory ?
Avatar of zizi21

ASKER

Pls take a look