| 1 | #include "ace/OS_NS_stdio.h" |
| 2 | #include "ace/OS_NS_string.h" |
| 3 | #include "ace/ACE.h" |
| 4 | |
| 5 | |
| 6 | int |
| 7 | ACE_TMAIN(int argc, ACE_TCHAR *argv[]) |
| 8 | { |
| 9 | FILE *infile, *outfile; |
| 10 | char buf[BUFSIZ]; |
| 11 | |
| 12 | if ((infile = ACE_OS::fopen (argv[1], "r")) == 0) |
| 13 | return -1; |
| 14 | |
| 15 | if ((outfile = ACE_OS::fopen (argv[2], "w")) == 0) |
| 16 | return -1; |
| 17 | |
| 18 | int count = 0; |
| 19 | while (ACE_OS::fgets (buf, BUFSIZ, infile)) |
| 20 | { |
| 21 | buf[ACE_OS::strlen(buf) - 1] = '\0'; |
| 22 | ACE_OS::fputs (buf, outfile); |
| 23 | if (count % 2 == 0) |
| 24 | ACE_OS::fputs (" ", outfile); |
| 25 | else |
| 26 | ACE_OS::fputs ("\n", outfile); |
| 27 | count++; |
| 28 | } |
| 29 | |
| 30 | ACE_OS::fclose (outfile); |
| 31 | ACE_OS::fclose (infile); |
| 32 | } |