Linux FIFO´úÂëÎÊÌâ - Linux/UnixÉçÇø / ³ÌÐò¿ª·¢Çø
/*speak.c*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FIFO_NAME "american_maid"
int main(void)
{
char s[300];
int num, fd;
mknod(FIFO_NAME, S_IFIFO | 0666, 0);
printf("waiting for readers...\n");
fd = open(FIFO_NAME, O_WRONLY);
printf("got a reader--type some stuff\n");
while (gets(s), !feof(stdin)) {
if ((num = write(fd, s, strlen(s))) == -1)
perror("write");
else
printf("speak: wrote %d bytes\n", num);
}
return 0;
}
/*tick.c*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FIFO_NAME "american_maid"
int main(void)
{
char s[300];
int num, fd;
mknod(FIFO_NAME, S_IFIFO | 0666, 0);
printf("waiting for writers...\n");
fd = open(FIFO_NAME, O_RDONLY);
printf("got a writer\n");
do {
if ((num = read(fd, s, 300)) == -1)
perror("read");
else {
s[num] = '\0';
printf("tick: read %d bytes: \"%s\"\n&
Ïà¹ØÎÊ´ð£º
int dValue = pthread_mutex_lock(&g_ThreadMutex);
if (0 != dValue)
{
. pthread_mutex_unlock(&g_ThreadMutex);
. return pToDealing;
}
----------------ʧ°Üºó£¬ÔÙµ÷ÓúìÉ«²¿·Ö£¬»á²»»áµ¼Ö³ÌÐ ......
ÔÚubuntuÉϴÁË·þÎñÆ÷£¬¸ùĿ¼Ϊ/var/www£¬Ê¹ÓÃphp½Å±¾ÔÚ/var/www/htmlÎļþ¼ÐÏÂÉú³ÉÁËÎļþ¼ÐºÍÎļþ£¬Éú³ÉµÄ¸ñʽÊÇ/var/www/html/123456/sss.html£¬Éú³Éºó²é¿´htmlÎļþ¼ÐµÄȨÏÞÊÇwww-data£¬ÎÒÖ´ÐÐphpµÄɾ³ý½Å±¾µÄʱ ......
ÓÐËÓÐlinuxÃüÁîµÄËõдÓëȫдµÄ¶ÔÕÕ£¬±ÈÈçcd--[change directory]£¬×îºÃÃüÁîÄÜ·ÖÀ࣡
linux ÃüÁî´óÈ«
http://net.pku.edu.cn/~course/cs101/2008/resource/linux_command_tutorial.pdf
ÕâÀïÒ²ÓÐ
http://www.ve ......
ÔÚlinuxϰ²×°µÄeclipse£¬ÔÚeclispeÖа²×°ÁËsvn²å¼þ£¬ Èç¹ûÐ޸ĺÍɾ³ýsvnÃÜÂ룿
csdn²»ÊǺܶà¸ßÊÖô? »òÕßÓÐËÖªµÀwindowsϵÄC:\Documents and Settings\Administrator\Application DataÕâ¸öĿ¼¶ÔÓ¦µ½linuxÄĸöÄ¿ ......
ÎÒÓà pthread_create ´´½¨Ò»¸öỊ̈߳¬»ñµÃÏØ³ÇµÄid;
idÊÇÈ«¾Ö±äÁ¿£¬ÎÒÏëÖÐÆäËûº¯ÊýÖÐÏû³ýÕâ¸öº¯Êý£¬ÇëÎÊÓ¦¸ÃÔõô×ö£¿
×îºÃÁгöÀý×Ó£¬Ð»Ð»¡£
û¿´Ã÷°×°¡....
void main()
{
pthread_t id;
_create(); //´´½¨Ï ......