After cleaning it up heavily, it works fine for me. Try this and see if it makes any difference
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
int N, x, iter = 1;
FILE *outptr;
if ( ( outptr=fopen("myOutput.txt","w") ) != NULL ) {
printf("\nPlease enter a value for N ");
scanf("%i",&N);
printf("\n");
for(x = N, iter = 0; x > 1; x--)
{
printf("%i", x), fprintf(outptr, "%i", x);
printf(" + "), fprintf(outptr, " + ");
iter = iter + x;
}
printf(" 1 = "), fprintf(outptr, " 1 = ");
printf("%i", iter), fprintf(outptr, "%i", iter);
getchar();
fclose(outptr);
}
else
printf ( "Error opening file\n" );
return 0;
}
-Prelude