So for starters; you can get rid of <iostream>
and <fstream>
includes. Replace them with <stdio.h>
.
You don't need namespace std if I'm not mistaken also.
Replace strings with char*.
Replace cout
with printf
.
For opening/reading files you can use fopen
. Example:
FILE *ifp, *ofp;
char *mode = "r";
char outputFilename[] = "out.list";
ifp = fopen("in.list", mode);
if (ifp == NULL) {
fprintf(stderr, "Can't open input file in.list!\n");
exit(1);
}
ofp = fopen(outputFilename, "w");
if (ofp == NULL) {
fprintf(stderr, "Can't open output file %s!\n",
outputFilename);
exit(1);
}
For further input/output information please look here.