And DON'T USE
& with %s and a character array.
ummm... could an fgets possibly improve my situation?
Code:
fgets(InputLine, 49, FileIn);
and would this be the proper implementation for the rest of the code?
Code:
Position = 1;
while ((fscanf("%s",InputLine))!=EOF)
{
if (InputLine == (""))
{
if (Position > 1)
{
fprintf(FileOut, "\n");
}
fprintf(FileOut, "\n");
Position = 1;
}
else
{
if ((Position+(strlen(InputLine))-1) > LINE_SIZE)
{
fprintf(FileOut, "\n");
Position = 1;
}
fprintf (FileOut, "%s\n", InputLine);
Position += (strlen(InputLine));
if (Position <= LINE_SIZE)
{
fprintf (FileOut, " ");
Position++;
}
}
fscanf(FileIn, "%s", &InputLine);
}
//The end has come, repent sinners, REPENT!!!
fclose(FileIn);
fclose(FileOut);
}
*edit* in between classes I was able to compile my new version of my code but unfortunatly I receive this:
59: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type
Code:
while ((fscanf("%s",InputLine))!=EOF)
and when I run it afterwards I receive a bus error
any ideas on how to proceed?