GUID in C

S

some one

I'm writing a program in C (microsoft vc++) to read in a binary file
(which was created by a C++ program) where a few fields are C++ GUIDs.
I'm not sure how to define my variable to read in this GUID.
Is GUID a pre-defined type in C? Which header file is it defined in?
How do I declare the variabe to read in the proper data? I know that
it is 16 byte struct similar to the following:
struct GUID_ex {
int a;
short b;
short c;
unsigned char d[8];
};
Do I have to declare it or does it already exist and how can I use
it. Would appreciate some comments. thanks
 
A

Alexander Bartolich

begin followup to some one:
I'm writing a program in C (microsoft vc++) to read in a binary
file (which was created by a C++ program) where a few fields are
C++ GUIDs.

GUID is part of the WIN32 API, not C++.

http://www.webopedia.com/TERM/G/GUID.html
I'm not sure how to define my variable to read in this GUID.

Search the include files of your compiler. Either in Explorer
or IDE. The directory with these files is at the expected location
under c:\program files\
Is GUID a pre-defined type in C?

No. Which reminds me that this whole thing is completely off-topic
round here. comp.os.ms-windows.* or microsoft.public.* should do.
 
P

pete

some said:
I'm writing a program in C (microsoft vc++) to read in a binary file
(which was created by a C++ program) where a few fields are C++ GUIDs.
I'm not sure how to define my variable to read in this GUID.
Is GUID a pre-defined type in C?

No.
 
M

Malcolm

some one said:
I'm writing a program in C (microsoft vc++) to read in a binary file
(which was created by a C++ program) where a few fields are C++
GUIDs.
ANSI C and, I'm pretty sure, ANSI C++ don't define GUID.
I'm not sure how to define my variable to read in this GUID.
Is GUID a pre-defined type in C? Which header file is it defined in?
Microsoft or some extension used by Microsoft may define GUID.
How do I declare the variabe to read in the proper data? I know that
it is 16 byte struct similar to the following:
struct GUID_ex {
int a;
short b;
short c;
unsigned char d[8];
};
Do I have to declare it or does it already exist and how can I use
it. Would appreciate some comments. thanks
Why not use a search tool to look for the string "GUID" in all files with a
..h extension? That will tell you if Microsoft define it.

If Microsoft do define GUID, you are probably better off going with their
definition, unless you need to port the program to other platforms. The
reason is that if the definition changes, Microsoft will probably update the
headers.

In that case, define your own structure and use low-level calls to fgetc()
to read the id in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top