Solved

Struct

Posted on 1997-09-05
4
244 Views
Last Modified: 2008-03-10
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.
0
Comment
Question by:JDS
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
gaohong earned 50 total points
ID: 1168961
Compiler expects you pass a object instead of reference or pointer. Checking function protocol and arguments type

good luck
0
 

Author Comment

by:JDS
ID: 1168962
No I needed to put an * at the end of the struct def.
0
 

Author Comment

by:JDS
ID: 1168963
No I needed to put an * at the end of the struct def.
0
 

Expert Comment

by:hacksmith
ID: 1168964
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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question