Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Struct

Posted on 1997-09-05
4
Medium Priority
?
250 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 100 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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.
Suggested Courses

876 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