|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|||
Seriously?
"u_char" == unsigned char. Right, well it seems FreeBSD lacks a types(5) man page, but you could still find the approrate header in less then a few seconds by grep'ing through /usr/include. /usr/include/sys/types.h: typedef unsigned char u_char; |
|
||||
You'll find most u_type / utype's are just typedefs like many things are.
Hmm, I knew there was a reason I always write 'unsigned char' when I mean a char that is unsigned.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
If I'm going to be writing something that'll be used on multiple architectures, C99 stdint types come in handy. (For instance, as is being fixed in a lot of OpenBSD ports, sizeof(long) != 4 everywhere.)
|
|
||||
as bsdfan666 said u_char is defined in /usr/include/sys/types.h so if you want to use u_char datatype then you need to add #include <sys/types.h> to your program.
sys/types.h defines many system data types to hide the implementation details from the programmer. btw, why not just use unsigned char? |
|
||||
thanks guys, types.h solve the problem, is there a good reference explain BSD libraries, i googled u_char 4 hours with no luck and read FreeBSD developers handbook but nothing much.
thanks again guys
__________________
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works... and nobody knows why! (Albert Einstein) |
|
||||
I would recommended a copy of one of the C Standards and POSIX.
Most of the important stuff if not all the libraries shipped out of box should have a manual page describing their usage, ones I've looked at provides function call level manual pages. The system manuals are really helpful for system calls, (n)curses, working with network sockets , kernel interfaces, and even looking up standard library routines should you forget one (including posix related ones).
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|