MASTER.H FOR C
Consolidates frequently used standard and platform-specific C headers into a single cohesive library. Designed for rapid prototyping, systems programming, and competitive problem solving across Linux, macOS, and Windows.
Consolidates frequently used standard and platform-specific C headers into a single cohesive library. Designed for rapid prototyping, systems programming, and competitive problem solving across Linux, macOS, and Windows.
Dynamic memory allocation, formatted stream input/output, fixed-width integer types, and boolean definitions.
Buffer manipulation, null-terminated ASCII string operations, wide-character support, and character class validation.
Trigonometric functions, power routines, complex number arithmetic, and platform architecture numeric boundaries.
File descriptor operations, directory traversal, file metadata inspection, and low-level system call wrappers.
POSIX threads, signal handling, process creation and fork synchronization routines.
Conditional socket includes seamlessly bridging Berkeley sockets on Unix/Linux/macOS with Winsock2 on Windows.
The header uses preprocessor macros to detect host operating systems, automatically providing Windows Sockets (<winsock2.h>) or POSIX networking (<sys/socket.h>) without breaking portability:
#ifndef MASTER_H
#define MASTER_H
// Standard I/O, Strings & Math
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
// Cross-Platform Networking Guards
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#endif // MASTER_H