• C

urgent: how to concat files in C


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
Who is Participating?
n2fcConnect With a Mentor Commented:
You can always use the "system" call to access the shell commands!

This way you can use ANY shell command (like cat) from within c...
cat uses almost same algo as You mentioned - opens every file, read and writes to stdout.
zizi21Author Commented:
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 ?
Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

zizi21Author Commented:
I don't understand. When fread and fwrite is used, you need a buffer. Does this mean that cat doesn't use buffer memory ?
zizi21Author Commented:
i have posted the question regarding cat below:
zizi21Author Commented:
Pls take a look
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.