Hello Guru's.
I'm comming from VB background so have nightmare to switch to C/C++ in rewriting of simple programs, actually, to start ith cpp.
So, situation is:
header il.h
Code:
int ReadIL(bool RW, long ILRecord, IL);
struct ILRec
{
char myRowStr[30];
int myRowInt;
float myRowf;
char myNextStr[300];
}IL;
then:
file il.cpp
Code:
#include "il.h"
#include <stdio.h>
#include <string.h>
int ReadIL(RW, ILRecord, IL)
{
int ILLength=sizeof(struct ILRec);
FILE *f;
f=fopen("junk.dat","wb+");
if (ILRecord<1) ILRecord=1;
if (!f) return 1;
{
fseek(f,(ILLength*(ILRecord-1)),SEEK_SET);
if (RW)
{
// strcpy(IL.myRowStr,"my string to file");
fwrite(&IL, ILLength, 1, f);
}
else
{
fread(&IL, ILLength, 1, f);
}
}
fclose(f);
return 0;
}
In my main cpp program I have also included il.h
and from there I call function like this:
Code:
long ILRecord=1;
ReadIL(false, ILRecord, IL);
And I get several errors during compiling
C:\Users\John\Desktop\aaa\il.h|1|error: 'IL' has not been declared|
C:\Users\John\Desktop\aaa\aaaMain.cpp||In member function 'void aaaFrame::OnbtnOpenClick(wxCommandEvent&)':|
C:\Users\John\Desktop\aaa\aaaMain.cpp|344|error: cannot convert 'ILRec' to 'int' for argument '3' to 'int ReadIL(bool, long int, int)'|
||=== Build finished: 2 errors, 0 warnings ===|
Purpose of wanted program is to chose a record in Main program (ILRecord) and to get required data in structure IL from function ReadIL from other file in same project.
What do I do bad and how to get this to work?
Please for recommendation at newbie level.