472,981 Members | 1,459 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

Opaque data type

Hi All,
Could you tell how to implement opaque data type
with an example ? Or link to a documentation will
be great !!


Nov 14 '05 #1
1 5024

Labora wrote:
Hi All,
Could you tell how to implement opaque data type
with an example ? Or link to a documentation will
be great !!

An opaque data type is one you can only operate on
using functions or macros. So, define your data type
somewhere and provide the stuff the users need to work
with it. They do not need to know how you organised the
In fact, that is the whole point: If you reorganise
the data, then the user interface will not change --
you only have to provide other definitions for the
functions and macros.

Example: FILE from <stdio.h>.
You get a FILE * at opening a file with fopen(), can use
it to read or write to file with fputs()/fprintf() or
fgets()/fscanf() and others, respectively, can
store positions with fgetpos() (in another opaque data type)
and set positions with fsetpos() (using the return value
of a previous fgetpos() call) [there also is fseek() but
this should no longer be used nowadays] or rewind(),
can delete files, and you can close the file with fclose()
-- but you never, ever directly access an entry of FILE
(say a struct member if FILE is a structure).
E-Mail: Mine is a gmx dot de address.

Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Capstar | last post by:
Hi NG, I've read some time ago in this NG, that when you're writing a library it can be good practice to use an opaque type to point to your structures if the user doesn't need to modify the...
by: Kurt Ng | last post by:
Hi, y'all. Can anyone help me on this problem? I'm working with a third-party C dll, and I'm having trouble importing into C# the dll's methods that return one of the dll's defined types,...
by: chankl | last post by:
Can anyone explain what's an opaque pointer and how it's implemented in C? I read about this concept in the book "C interfaces and implementations". Here's an example from the book (list.h -...
by: Ernesto Bascón | last post by:
Hi everybody: I have two questions: 1. I'm using opaque pointers in my classes to hide their data structures; there is a way to use opaque pointers in template classes; since the...
by: Richard Weeks | last post by:
I have a library of functions for operations on complex numbers and a complex type defined as a struct in a header also containing the prototypes for the library. I want to make this an opaque...
by: Don Taylor | last post by:
I want to build an application in Python that can show an opaque window so that you can still see and type into any window that it covers. Sort of like a software mylar transparency sheet placed...
by: bantunks | last post by:
Hello, I am trying to figure out the advantages and disadvantages of exposing interfaces through Opaque data types in C. I have figured/found out the following two advantages 1. Higher level of...
by: Nate Eldredge | last post by:
Consider the following pseudo-code: #include <opaque.h> struct foo { int a; opaque_t op; int b; };
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.