andandandand
andandandand

Reputation: 22270

Which C/C++ header file defines a BYTE data type?

I'm porting a header with this declaration:

 struct tMaterialInfo {     
    char strName[255]; // the texture name
    char strFile [255]; // the texture
     BYTE color [3]; // the color of the object 
 };

The header has the following includes:

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <fstream>
#include <vector>
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include<gl\glu.h>// Header File For The GLu32 Library
#include <gl\glaux.h>

Where does that BYTE come from?

Upvotes: 30

Views: 82067

Answers (3)

user295190
user295190

Reputation:

If you are programming C for Windows I assume you are using Visual Studio to develop. You can right click on any keyword and select Go To Definition F12 to find where it is defined.

BYTE is defined in WinDef.h

typedef unsigned char       BYTE;

Upvotes: 11

RBerteig
RBerteig

Reputation: 43306

Almost certainly from one of the many headers included from windows.h. The Windows SDK has included typedefs for BYTE, WORD, and DWORD since at least Windows 2.0 days (the earliest Windows SDK I recall having).

Upvotes: 5

dsolimano
dsolimano

Reputation: 8986

I'm guessing it's from Windows.

A byte (8 bits).

This type is declared in WinDef.h as follows:

typedef unsigned char BYTE;

Upvotes: 32

Related Questions