Linux CѧϰС×é³ÉÔ±×÷Òµ»Ø¸´×¨ÓÃÌû - C/C++ / CÓïÑÔ
Linux CѧϰС×é³ÉÔ±×÷Òµ»Ø¸´×¨ÓÃÌû¡£
л¾øÎÞÓûظ´Ð»Ð»£¡
»ØÒ»¸ö£¬ÎÊÌâÊÇÔõô½»Á÷
pxr
ɶÎÊÌâ°¡¡£
xsj
£¿£¿£¿
²»Çå³þÊÇʲôС×é³ÉÔ±×÷ÒµÄØ£¿
µã½â£¿
?
ʲôÊÇLinux CѧϰС×é?
?
ʲôÊÇLinux CѧϰС×é?
ʲô¶«Î÷£¿
ûÓÐ×÷Òµ°¡ ºÇºÇ
ʲôÊÇlinux CѧϰС×é°¡
ͬÎÊ
ʲôÒâ˼
/**********************************
4.19 (1)
read
***********************************/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
int main(void)
{
int fd, n;
char buf[30];
fd = open("/home/liaoye/lianxi/akae.txt", O_RDWR);
if(fd > 0)
{
printf("open success!\n");
}
else
{
printf("open error!\n");
exit(1);
}
read(fd, buf, 30);
printf("%s", buf);
return 0;
}
/**********************************
4.19 (2)
COPY
read AND write
*******
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ÈçÌ⣬C/C++ÖеÄexeclÔõôµ÷ÓÃдºÃµÄjava³ÌÐò£¬
execl("/opt/java1.5/bin/java","MyClass",NULL);
ÕâÑùµÄ²»ÐÐŶ¡£
²»»á.
ÔËÐÐjava³ÌÐò
ÕÒ¹¤¾ß²é¿´Ò»ÏÂÄǸö³ÌÐòµÄÃüÁîÐÐ
ËÑË÷Ï£ºjni ......
ÇëÎÒÓÃFCKÉÏ´«Îļþ,ÔÚ±¾µØµÄwindows»úÉϲâÊÔ¿ÉÒÔ£¬µ«²¿Êðµ½linux·þÎñÆ÷ÉϾÍÉÏ´«²»ÁËÎļþ£¬ÉÏ´«Îļþʱһֱ¿¨ÔÚÄÇÀï¡£Íû¸÷λ´óϺָµã£¬Ð»Ð»£¡
·¹ý£¬°ïÄ㶥һÏ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
ÉÏ´«ÎļþµÄ·¾¶ÎÊÌ⣬ ......
ÔÚ¸ùĿ¼/libÖдæ·ÅÒ»¸ölog.c£¬log.h£¬²¢ÓÃÏÂÃæµÄÓï¾ä£º
gcc -c log.c
ar crv liblog.a log.o
±àÒë³öÒ»¸öliblog.a¾²Ì¬¿â£¬È»ºóÔÚÎļþ¼Ð£º/testfileÖд´½¨Ò»¸ötest.cºÍtestc.c£¬test.cÖÐÒýÓÃÁËtestc.cÖж¨ÒåµÄ·½·¨ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......