Solved

Struct

Posted on 1997-09-05
4
243 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

803 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