By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,413 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,413 IT Pros & Developers. It's quick & easy.

GUID in C

P: n/a
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
Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
Für Google, Tux und GPL!
Nov 14 '05 #2

P: n/a
some one wrote:

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.

--
pete
Nov 14 '05 #3

P: n/a

"some one" <fr********@yahoo.com> wrote in message
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.
Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.