»ñÈ¡linuxËùÓÐÓû§ÐÅÏ¢
#include <iostream>
#include <pwd.h>
#include <sys/types.h>
#include <stddef.h>
#include <string>
#include <list>
using namespace std;
void GetUser(list<string>& lsUser);
int main()
{
list<string> lsUser;
GetUser(lsUser);
cout << "all user name in current computer:" << endl;
list<string>::iterator it;
for (it = lsUser.begin(); it != lsUser.end(); it++)
{
cout << it->c_str()<< endl;
}
return 0;
}
void GetUser(list<string>& lsUser)
{
struct passwd* pstPwd = NULL;
setpwent();
while ( (pstPwd = getpwent()) != NULL )
{
lsUser.push_front(pstPwd->pw_name);
}
endpwent();
}
Ïà¹ØÎĵµ£º
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
×÷Õߣº51cto
http://www.ccw.com.cn 2009-02-27 11:06:03
µ±Äã¶Ô±ðÈË˵£¬“ÎÒÒªÂòÁ¾³µ¡£”ËûÂíÉϾͻáÎÊÄ㣺“ʲô³µ£¿”¸£ÌØ¡¢·áÌï¡¢»¹ÊDZ¾ÌÊÇË«ÃÅÅܳµ¡¢Ð¡½Î³µ¡¢»¹ÊÇÃæ°ü³µ£¿µ±È»£¬»¹ÓÐÆäËûÀàËÆµÄÎÊÌâ¡£
ͬÑù£¬Èç¹ûÄã˵“ÎÒÏë°²×°Linux£¡”Äã»á±»Îʵ½Í¬ÑùµÄÎÊÌ⣺ÄĸöLinu ......
ÔÚLinuxϽøÐÐCÓïÑÔ±à³Ì£¬±ØÈ»Òª²ÉÓÃGNU GCCÀ´±àÒëCÔ´´úÂëÉú³É¿ÉÖ´ÐгÌÐò¡£GccÖ¸ÁîµÄÒ»°ã¸ñʽΪ£º
Gcc [Ñ¡Ïî] Òª±àÒëµÄÎļþ [Ñ¡Ïî] [Ä¿±êÎļþ]¡£ÆäÖУ¬Ä¿±êÎļþ¿Éȱʡ£¬GccĬÈÏÉú³É¿ÉÖ´ÐеÄÎļþÃûΪ£º±àÒëÎļþ.out
¿´Ò»Ï¾µäÈëÃųÌÐò"Hello World£¡"
# vi hello.c £¬±à¼ÈçÏ£º
#inclu ......
ÉèÖÃdsnºóËäÈ»ÐéÄâ»ú¿ÉÒÔÉÏÍøÁË£¬µ«ÊÇÓû§Ãû±ä³ÉÁËbogon£¬¶ø²»ÊÇ֮ǰµÄlocalhost£¬È¥µôDNSºóÖØÆôÐéÄâ»ú¾ÍÓÖ±ä³ÉÁËlocalhost
È»ºó¾Í¿ÉÒÔmount±¾»úÁË
»¹ÓÐÒ»ÖÖ·½·¨£º
hostname ÏÔʾµ±Ç°Ö÷»úÃû
hostname localhost ÉèÖõ±Ç°Ö÷»úÃûΪlocalhost
¹À¼ÆÒ²¿ÉÒÔ½â¾öÉÏÊö²»ÄÜmountµÄÎÊÌâ¡£ ......