unexpected result, no display of input string
The bolded part doesn't seem to function
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STRLENGTH 80
int main (int argc, char *argv[])
{
FILE *out;
char str[STRLENGTH];
/* if(argc!=2)
{
printf("Please enter output location\n");
exit(1);
} */
if( (out=fopen("Text","w")) == NULL)
{
printf("Error in creating file\n");
exit(1);
}
printf("Please enter the text to be inputed:\n");
do
{
gets(str);
strcat(str,"\n");
fputs(str,out);
if(ferror(out)) printf("Error");
}while(*str!='/n');
rewind(out);
while(!feof(out))
{
fgets(str,79,out);
printf(str);
} for(;;);
return 0;
}