Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

c

windows

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?

like image 453
andandandand Avatar asked Dec 20 '10 01:12

andandandand


People also ask

What is the byte data type in C?

A byte is typically 8 bits. C character data type requires one byte of storage. A file is a sequence of bytes. A size of the file is the number of bytes within the file.

Where is byte defined in C?

@Ben: The C and C++ standards unambiguously define a "byte" as the size of a char , which is at least 8 bits.

Where is byte defined?

In most computer systems, a byte is a unit of data that is eight binary digits long. A byte is the unit most computers use to represent a character such as a letter, number or typographic symbol. Each byte can hold a string of bits that need to be used in a larger unit for application purposes.

What is header file in C?

A header file is a file with extension . h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.


1 Answers

I'm guessing it's from Windows.

A byte (8 bits).

This type is declared in WinDef.h as follows:

typedef unsigned char BYTE;

like image 198
dsolimano Avatar answered Oct 17 '22 11:10

dsolimano