The "p" Package
These routines are meant to provide a low level means of converting C data
types to the "network" data format (ie. big endian, IEEE 754).
These are memory to memory routines only. Although they are made public,
their use is NOT recommended.
When reading or writing raw data from and to files or connections, the
pio routines are suggested.
Library: karma
Link With: -lkarma
Functions
Functions
flag
p_write_buf_float (char *buffer, float data)
Write a floating point number to a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 4 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to IEEE network format prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf_float (char *buffer, float *data)
Read a floating point number from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 4 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Note: - The data will be converted from IEEE network format after reading.
flag
p_write_buf_double (char *buffer, double data)
Write a double precision floating point number to a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 8 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to IEEE network format prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf_double (char *buffer, double *data)
Read a double precision floating point number from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 8 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Note: - The data will be converted from IEEE network format after reading.
flag
p_write_buf16s (char *buffer, long data)
Write 16 bits of signed data to a buffer,
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to network byte order prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf16s (char *buffer, long *data)
Read 16 bits of signed data from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_write_buf32s (char *buffer, long data)
Write 32 bits of signed data to a buffer,
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to network byte order prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf32s (char *buffer, long *data)
Read 32 bits of signed data from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_write_buf16 (char *buffer, unsigned long data)
Write 16 bits of unsigned data to a buffer,
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to network byte order prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf16 (char *buffer, unsigned long *data)
Read 16 bits of unsigned data from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 2 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_write_buf32 (char *buffer, unsigned long data)
Write 32 bits of unsigned data to a buffer,
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 4 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to network byte order prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf32 (char *buffer, unsigned long *data)
Read 32 bits of unsigned data from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 4 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_write_buf64 (char *buffer, unsigned long data)
Write 64 bits of data to a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 8 bytes long
- data :
The data. This must be in host natural byte order. The data will be
converted to network byte order prior to writing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
p_read_buf64 (char *buffer, unsigned long *data)
Read 64 bits of signed data from a buffer.
Parameters:
- buffer :
A pointer to the buffer. This buffer must be at least 8 bytes long
- data :
The output data will be written here. This will be in host natural
byte order. The data will be converted from network byte order after
reading.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Contact: Richard Gooch
Web Development: Ariel Internet Services