Hi, i have som functions in a header file. But i get errors at compilation.
#include <stdio.h>
//#include <limits.h>
#include <math.h>
#include <string.h>
//define error codes
enum
{
PERROR_FILEOPEN,
PERROR_FILECLOSE
};
//other defines
#define P_LINELIMIT 512
//globally needed variables
int P_Error = 0;
char P_Line[P_LINELIMIT];
//typedefs
typedef FILE P_File;
//Error and Debug functions
void P_SetError(int err)
{
P_Error = err;
}
//File functions
P_File * P_OpenFile(char file[]) //Opens a P file and returns its handle
{
FILE * f = fopen(file, "r");
if(f == NULL)
{
P_SetError(PERROR_FILEOPEN);
}
return (P_File*)f;
}
bool P_RunFile(P_File * file)
{
//if syntax error: return false
while(true)
{
P_Line = fgets(P_Line, P_LINELIMIT, (FILE*)file);
}
return true;
}
bool P_CloseFile(P_File * file)
{
if(fclose((FILE*)file) != 0)
{
P_SetError(PERRPR_FILECLOSE);
return false;
}
else
{
return true;
}
}
===========================================================
ERRORS:
===========================================================
Error 2 error C2061: syntax error : identifier 'P_RunFile' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 40
Error 3 error C2059: syntax error : ';' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 40
Error 4 error C2059: syntax error : 'type' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 40
Error 5 error C2061: syntax error : identifier 'P_CloseFile' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 50
Error 6 error C2059: syntax error : ';' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 50
Error 7 error C2059: syntax error : 'type' c:\documents and settings\nti\mina dokument\visual studio 2005\projects\p\p\p.h 50