Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linuxϵͳµ÷Óà accessº¯ÊýÏê½â

Linuxϵͳµ÷ÓÃ--accessº¯ÊýÏê½â
2007-07-30 23:10
 ¡¾accessϵͳµ÷Óá¿
 
¹¦ÄÜÃèÊö£º
¼ì²éµ÷Óýø³ÌÊÇ·ñ¿ÉÒÔ¶ÔÖ¸¶¨µÄÎļþÖ´ÐÐijÖÖ²Ù×÷¡£
 
Ó÷¨£º
#include <unistd.h>
#include <fcntl.h>
int access(const char *pathname, int mode);  
 
²ÎÊý£º
pathname: ÐèÒª²âÊÔµÄÎļþ·¾¶Ãû¡£  
mode: ÐèÒª²âÊԵIJÙ×÷ģʽ£¬¿ÉÄÜÖµÊÇÒ»¸ö»ò¶à¸öR_OK(¿É¶Á?), W_OK(¿Éд?), X_OK(¿ÉÖ´ÐÐ?) »ò F_OK(Îļþ´æÔÚ?)×éºÏÌå¡£
 
·µ»ØËµÃ÷£º
³É¹¦Ö´ÐÐʱ£¬·µ»Ø0¡£Ê§°Ü·µ»Ø-1£¬errno±»ÉèΪÒÔϵÄij¸öÖµ
EINVAL£º ģʽֵÎÞЧ  
EACCES£º Îļþ»ò·¾¶ÃûÖаüº¬µÄĿ¼²»¿É·ÃÎÊ
ELOOP £º ½âÊÍ·¾¶Ãû¹ý³ÌÖдæÔÚÌ«¶àµÄ·ûºÅÁ¬½Ó
ENAMETOOLONG£ºÂ·¾¶ÃûÌ«³¤
ENOENT£º  ·¾¶ÃûÖеÄĿ¼²»´æÔÚ»òÊÇÎÞЧµÄ·ûºÅÁ¬½Ó
ENOTDIR£º ·¾¶ÃûÖе±×÷Ŀ¼µÄ×é¼þ²¢·ÇĿ¼
EROFS£º Îļþϵͳֻ¶Á
EFAULT£º ·¾¶ÃûÖ¸Ïò¿É·ÃÎʵĿռäÍâ
EIO£º  ÊäÈëÊä³ö´íÎó
ENOMEM£º ²»ÄÜ»ñÈ¡×ã¹»µÄÄÚºËÄÚ´æ
ETXTBSY£º¶Ô³ÌÐòдÈë³ö´í
Àý×Ó£º
 
/* test.c */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
 
int main(int argc, char *argv[])
{
    if (argc < 2) {
        printf("Usage: ./test filename\n");
        exit(1);
    }
 
    if (access(argv[1], F_OK) == -1) {
        puts("File not exists!");
        exit(2);
    }
 
    if (access(argv[1], R_OK) == -1)  
        puts("You can't read the file!");
    else
        if (access(argv[1], R_OK | W_OK) != -1)
            puts("You can read and write the file");
        else
       &n


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

ʵսLinux Bluetooth±à³Ì(Áù) L2CAP±à³ÌʵÀý

ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
 Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......

linux systemº¯ÊýʹÓÃÏê½â


Ïà¹Øº¯Êý
fork£¬execve£¬waitpid£¬popen
±íÍ·Îļþ
££i nclude<stdlib.h>
¶¨Ò庯Êý
int system(const char * string);
º¯Êý˵Ã÷
system()»áµ÷ÓÃfork()²úÉú×Ó½ø³Ì£¬ÓÉ×Ó½ø³ÌÀ´µ÷ÓÃ/bin/sh-c stringÀ´Ö´ÐвÎÊýstring×Ö·û´®Ëù´ú±íµÄÃüÁ´ËÃü>ÁîÖ´ÐÐÍêºóËæ¼´·µ»ØÔ­µ÷ÓõĽø³Ì¡£ÔÚµ÷ÓÃsystem()ÆÚ¼äSIGCHLD ÐÅ ......

ʵÀý½âÎölinuxÄÚºËI2CÌåϵ½á¹¹£¨2£©


×÷ÕߣºÁõºéÌÎ,»ªÇåÔ¶¼ûǶÈëʽѧԺ½²Ê¦¡£
ËÄ¡¢ÔÚÄÚºËÀïдi2cÉ豸Çý¶¯µÄÁ½ÖÖ·½Ê½
ǰÎĽéÉÜÁËÀûÓÃ/dev/i2c-0ÔÚÓ¦ÓòãÍê³É¶Ôi2cÉ豸µÄ²Ù×÷£¬µ«ºÜ¶àʱºòÎÒÃÇ»¹ÊÇϰ¹ßΪi2cÉ豸ÔÚÄں˲ã±àдÇý¶¯³ÌÐò¡£Ä¿Ç°ÄÚºËÖ§³ÖÁ½ÖÖ±àдi2cÇý¶¯³ÌÐòµÄ·½Ê½¡£ÏÂÃæ·Ö±ð½éÉÜÕâÁ½ÖÖ·½Ê½µÄʵÏÖ¡£ÕâÀï·Ö±ð³ÆÕâÁ½ÖÖ·½Ê½Îª“Adapter·½Ê½£¨LEGAC ......

linuxºÍunixϳ£ÓýâѹºÍѹËõÃüÁî


linuxºÍunixϳ£ÓýâѹºÍѹËõÃüÁî
 
 
.tar
½â°ü£º tar xvf FileName.tar
´ò°ü£ºtar cvf FileName.tar DirName
£¨×¢£ºtarÊÇ´ò°ü£¬²»ÊÇѹËõ£¡£©
---------------------------------------------
.gz
½âѹ1£ºgunzip FileName.gz
½âѹ2£ºgzip -d FileName.gz
ѹËõ£ºgzip FileName
.tar.gz
½âѹ£ºtar ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ