?
Solved

urgent: how to concat files in C

Posted on 2011-05-07
6
Medium Priority
?
397 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:zizi21
  • 4
6 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 35711388
No,
cat uses almost same algo as You mentioned - opens every file, read and writes to stdout.
0
 
LVL 20

Accepted Solution

by:
n2fc earned 2000 total points
ID: 35711478
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...
0
 

Author Comment

by:zizi21
ID: 35711910
"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 ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:zizi21
ID: 35712037
I don't understand. When fread and fwrite is used, you need a buffer. Does this mean that cat doesn't use buffer memory ?
0
 

Author Comment

by:zizi21
ID: 35712353
i have posted the question regarding cat below:
http://www.experts-exchange.com/Programming/Languages/C/Q_27024223.html
0
 

Author Comment

by:zizi21
ID: 35712355
Pls take a look
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question