Trying to capture output, yes I am new to coding and this is part of an intro course.
#include <stdio.h>
#define MIN 1
#define MAX 30
FILE *fp;
int main(void) {
int i;
fp = fopen_s("csis.txt");
printf("%10s %10s %10s %10s %10s\n", "Value", "Square", "Cube", "4th", "5th");
fprintf(fp, "%10s %10s %10s %10s %10s\n", "Value", "Square", "Cube", "4th", "5th");
printf("%10s %10s %10s %10s %10s\n", "-----", "------", "----", "---", "---");
fprintf(fp, "%10s %10s %10s %10s %10s\n", "-----", "------", "----", "---", "---");
for (i = MIN; i <= MAX; ++i) {
printf("%10d %10d %10d %10d %10d\n", i, i * i, i * i * i, i * i * i * i, i * i * i * i * i);
fprintf(fp,"%10d %10d %10d %10d %10d\n", i, i * i, i * i * i, i * i * i * i, i * i * i * i * i);
}
fclose(fp);
return 0;
}
(24): warning C4047: 'function': 'FILE **' differs in levels of indirection from 'char [9]'
: warning C4024: 'fopen_s': different types for formal and actual parameter 1
error C2198: 'fopen_s': too few arguments for call
: warning C4047: '=': 'FILE *' differs in levels of indirection from 'errno_t'
This post was edited by Fizzical on Sep 3 2017 05:25pm