I get a compile error when it runs into my file pointer stuff. I am compiling using GCC, and am compiling .c files.
Code:
MAIN.C
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
printf("Hi");
message();
FILE * Tmp;
Tmp = fopen("hihello.txt", "a");
fprintf(Tmp, "Hi\nHello");
fclose(Tmp);
}
Code:
SUB.C
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int message()
{
printf("\nHello");
}
In function main:
Parse error before *
Tmp undeclared
...that sounds like I'm not using the correct header file?
Contents of my compile batch file:
Code:
@echo off
cls
path c:\mingw\bin;c:\windows\command
gcc -c -g main.c
gcc -c -g sub.c
gcc -o pgm main.o sub.o