C

text/x-csrc

Safe

Magic Bytes

Offset: 0
23 69 6E 63 6C 75 64 65 20

C is a general-purpose programming language source format originally developed by Dennis Ritchie at Bell Labs and currently maintained by the International Organization for Standardization. These files are utilized for developing operating systems, hardware drivers, and high-performance applications requiring low-level memory management and direct hardware interaction. While source code is inherently safe, the language lacks memory safety features, requiring developers to manually manage resources to prevent common vulnerabilities such as buffer overflows.

Extension

.c

MIME Type

text/x-csrc

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .c files in Python

Python
def is_c(file_path: str) -> bool:
    """Check if file is a valid C by magic bytes."""
    signature = bytes([0x23, 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x20])
    with open(file_path, "rb") as f:
        return f.read(9) == signature

How to validate .c files in Node.js

Node.js
function isC(buffer: Buffer): boolean {
  const signature = Buffer.from([0x23, 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x20]);
  return buffer.subarray(0, 9).equals(signature);
}
Go
func IsC(data []byte) bool {
    signature := []byte{0x23, 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x20}
    if len(data) < 9 {
        return false
    }
    return bytes.Equal(data[:9], signature)
}

API Endpoint

GET /api/v1/c
curl https://filesignature.org/api/v1/c

Related Formats