diff options
Diffstat (limited to 'ACE/netsvcs/clients/Naming/Dump_Restore/createfile.cpp')
-rw-r--r-- | ACE/netsvcs/clients/Naming/Dump_Restore/createfile.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ACE/netsvcs/clients/Naming/Dump_Restore/createfile.cpp b/ACE/netsvcs/clients/Naming/Dump_Restore/createfile.cpp new file mode 100644 index 00000000000..25bf2fb803c --- /dev/null +++ b/ACE/netsvcs/clients/Naming/Dump_Restore/createfile.cpp @@ -0,0 +1,34 @@ +// $Id$ + +#include <stdio.h> +#include <string.h> +#include "ace/ACE.h" + +ACE_RCSID(Dump_Restore, createfile, "$Id$") + +int +main (int argc, char **argv) +{ + FILE *infile, *outfile; + char buf[BUFSIZ]; + + if ((infile = fopen (argv[1], "r")) == NULL) + return -1; + + if ((outfile = fopen (argv[2], "w")) == NULL) + return -1; + + int count = 0; + while (::fgets (buf, BUFSIZ, infile)) + { + buf[::strlen(buf) - 1] = '\0'; + fputs (buf, outfile); + if (count % 2 == 0) + fputs (" ", outfile); + else + fputs ("\n", outfile); + count++; + } + fclose (outfile); + fclose (infile); +} |