fd=open("/dev/globalvar", O_RDWR, S_IRUSR|S_IWUSR); //可读写方式打开设备文件
S_IRUSR
Permits the file's owner to read it.
S_IWUSR
Permits the file's owner to write to it.
S_IRGRP
Permits the file's group to read it.
S_IWGRP
Permits the file's group to write to it.
S_ISREG ( ) 普通文件
S_ISDIR ( ) 目录文件
S_ISCHR ( ) 字符特殊文件
S_ISBLK ( ) 块特殊文件
S_ISFIFO ( ) 管道或F I F O
S_ISLNK ( ) 符号连接( P O S I X . 1或S V R 4无此类型)
S_ISSOC K ( ) 套接字(P O S I X . 1或S V R 4无此类型