Struct

I'm trying to use the OFSTRUCT structure but when I declair the varible as:
OFSTRUCT source;
the program gives me error that the program can't convert the varible from _OFSTRUCT* to _OFSTRUCT.
JDSAsked:
Who is Participating?
 
gaohongConnect With a Mentor Commented:
Compiler expects you pass a object instead of reference or pointer. Checking function protocol and arguments type

good luck
0
 
JDSAuthor Commented:
No I needed to put an * at the end of the struct def.
0
 
JDSAuthor Commented:
No I needed to put an * at the end of the struct def.
0
 
hacksmithCommented:
The Ofstruct structure is there to provide you with info about an  open file. The structure therefore is filled for you by the operating system and what you need is the ready made pointer to it which is supplied by you when the file is opened. See help under OpenFile..

lpOpenBuff is the empty pointer you supply as an argument which is filled with the address of the OFSTRUCT structure.

The structure receives information about the file when it is first opened. The pointer to the structure can then be used in subsequent calls to the open file.

The answer therefore is

1. supply an empty pointer

OFSTRUCT* mypointer;

2. open the file using openfile and using mypointer among the arguments and then use that pointer which will have the address of the OFSTRUCT of the file.

You can create your own OFSTRUCT on the heap using the new operator, but it will be empty and not much use.

 
0
All Courses

From novice to tech pro — start learning today.