ok, i figured that out a minute ago. everything is working now, i just need to flip the strings around (so the first one read in is at the bottom of the page, last one read in is at the top).
this is what i have so far:
Code:
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#define FILENAME "D:h4ot.txt"
#define INNAME "D:dat4.txt"
int main( void)
{
char string1 [50];
int k;
FILE* outfile;
outfile = fopen( FILENAME, "w" );
FILE* infile;
infile = fopen ( INNAME, "r");
while(fgets( string1, sizeof(string1), infile))
{
for ( k = 0; string1 [ k ] != '\0'; ++k )
{
if (isalpha(string1[k]))
{
fputc(string1[k], outfile);
}
else
{
switch (string1[k])
{
case ',':
case '.':
fputc(string1[k], outfile); break;
default:
fputc(' ', outfile);
}
}
}
fputc('\n', outfile);
}
fprintf(outfile, "%s", string1);
return 0;
}
this is what i am thinking: have a string2 that i can concatenate (strcat) string 1 to. then i keep adding string 2 to the end of string1 each time. The only problem is that i don't know how to declare or start the string2 so that it has 50 spaces that are empty.
thanks.