Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - INT 1
Search - INT 1 - List
用多线程同步方法解决读者阅览问题 1) 每个读者进入阅览室后,即时显示“Entered” 及其线程自定义标识,还同时显示阅览室共有几名顾客及其所坐的位置。 2) 至少有10个读者,每人阅览至少3秒钟。 3) 多个读者须共享操作函数代码。 2总的设计思想及系统平台、语言、工具: 设计思想:程序设定的是10个读者和5个座位,对读者进行编号,依次进入阅览室读书,为每一座位列一表目,包括座号和读者号等,读者离开时要登出,即消掉登记的信息。 系统平台:LINUX 语言:C语言 工具:vi编辑器、gcc编译器 操作系统:linux操作系统 调试工具:edit、masm、link、debug. 3数据结构与模块说明(功能与流程图) 数据结构 int count=0 //记录阅览室读者数量 sem_t full //定义阅览室座位信号量 int seat[5] //用数组表示座位 pthread_t reader[10] //定义读者线程 pthread_mutex_t mutex //定义互斥量 3.2功能说明 可以标识读者,随机为读者设置在阅览室的读书时间  可以显示阅览室读者的人数  可以显示读者所坐的位置,座位状态以及列出空座位
Date : 2008-10-13 Size : 864byte User : 谢冷阳

程序主要功能:linux 下通过串口控制智能系统,zo-b8l5a 5a八通道双值输出模块。一、 对应文件:ebus_module.tar.gz(包含三个文件ebus.cc、ebus.h、ebus_test.cc) 其中ebus.h是包含class E_bus的定义和声明的头文件;ebus.cc主要是类里面的函数;ebus_test.cc主要是类的使用,完成了循环依次关闭8路输出,打开8路输出的功能。二、 E_bus类的接口说明:打开或者关闭输出口,只需要函数int E_bus::ebus_control(string on_off,int out_n) 其中参数on_off代表打开还是关闭,对应值“on”、“off”。参数out_n代表的操作第几路,对应值 1、2、3、4、5、6、7、8;ebus_control的返回值:如果操作成功返回0,如果失败,返回负值。举例说明,E_bus abc; int c=abc.ebus_control(“off”,1) 如果c=0,说明第一路关闭成功。 -The main function of the program: linux serial control intelligent systems, the the zo-b8l5a 5a eight-channel double the value of output module. The a corresponding files: ebus_module.tar.gz (contains three files ebus.cc the ebus.h ebus_test.cc) which ebus.h header files contain the class E_bus definition statement ebus.cc class inside the a function ebus_test.cc mainly is the use of the class to complete the looping off the 8-channel output, open 8-channel output. Two, E_bus class interface description: Open or close the output port, only need to function int E_bus :: ebus_control (string on_off the int out_n) which parameters on_off represents the open or closed, the corresponding value " on" and " off" . On behalf of the operating parameters out_n few road, the corresponding value of 1, 2, 3, 4, 5, 6, 7, 8 ebus_control return value: If the operation is successful returns 0 if it fails to return a negative. For example, E_bus abc int c = abc.ebus_control (“off”,
Date : 2026-01-07 Size : 2kb User : zhang

linux 下串口编程 #include <stdio.h> /*标准输入输出定义*/ #include <stdlib.h> /*标准函数库定义*/ #include <unistd.h> /*Unix标准函数定义*/ #include <sys/types.h> /**/ #include <sys/stat.h> /**/ #include <fcntl.h> /*文件控制定义*/ #include <termios.h> /*PPSIX终端控制定义*/ #include <errno.h> /*错误号定义*/ /***@brief 设置串口通信速率 *@param fd 类型 int 打开串口的文件句柄 *@param speed 类型 int 串口速度 *@return void*/ -linux serial port programming under# include
Date : 2026-01-07 Size : 5kb User : Edward

用多线程同步方法解决读者阅览问题 1) 每个读者进入阅览室后,即时显示“Entered” 及其线程自定义标识,还同时显示阅览室共有几名顾客及其所坐的位置。 2) 至少有10个读者,每人阅览至少3秒钟。 3) 多个读者须共享操作函数代码。 2总的设计思想及系统平台、语言、工具: 设计思想:程序设定的是10个读者和5个座位,对读者进行编号,依次进入阅览室读书,为每一座位列一表目,包括座号和读者号等,读者离开时要登出,即消掉登记的信息。 系统平台:LINUX 语言:C语言 工具:vi编辑器、gcc编译器 操作系统:linux操作系统 调试工具:edit、masm、link、debug. 3数据结构与模块说明(功能与流程图) 数据结构 int count=0 //记录阅览室读者数量 sem_t full //定义阅览室座位信号量 int seat[5] //用数组表示座位 pthread_t reader[10] //定义读者线程 pthread_mutex_t mutex //定义互斥量 3.2功能说明 可以标识读者,随机为读者设置在阅览室的读书时间  可以显示阅览室读者的人数  可以显示读者所坐的位置,座位状态以及列出空座位 -err
Date : 2026-01-07 Size : 1kb User : 谢冷阳

DL : 0
#include<stdio.h> #include<string.h> #include<limits.h> #include<unistd.h> #include<sys/types.h> #define PROMPT_STRING "[myshell]$" #define QUIT_STRING "exit\n" static char inbuf[MAX_CANON] char * g_ptr char * g_lim extern void yylex() int main (void){ for( ){ if(fputs(PROMPT_STRING,stdout)==EOF) continue if(fgets(inbuf,MAX_CANON,stdin)==NULL) continue if(strcmp(inbuf,QUIT_STRING)==0) break g_ptr = inbuf g_lim = inbuf + strlen(inbuf) yylex() } return 0 } -# Include <stdio.h># Include <string.h># Include <limits.h># Include <unistd.h># Include <sys/types.h># Define PROMPT_STRING [myshell] $ # define QUIT_STRING exit static char inbuf [MAX_CANON] char* g_ptr char* g_lim extern void yylex () int main (void) (for () (if (fputs (PROMPT_STRING, stdout) == EOF) continue if (fgets (inbuf, MAX_CANON, stdin) == NULL) continue if (strcmp (inbuf, QUIT_STRING) == 0) break g_ptr = inbuf g_lim = inbuf+ strlen (inbuf) yylex ()) return 0)
Date : 2026-01-07 Size : 32kb User : 李明

麻雀虽小,五脏俱全加强版聊天室,源码来自网上搜得的,增加用户登录密码检查,聊天信息记录功能,版权归原作者所有,我只是修改下玩。在终端下执行,没有图形界面,没有创建子进程,利用int型数组保存客户accept套接字 -Sparrow may be small, fully-equipped enhanced version of chat rooms, source gathered from the Internet, and increase user login password checking, chat information recording function, belongs to original author, I just change the next play. Executed in a terminal, there is no graphical interface, did not create the child process, using an array of int type to save customers accept socket
Date : 2026-01-07 Size : 5kb User : 仁政

支持int<=>byte、short<=>byte、fload<=>byte高低字节转换工具-High and low bytes conversion tools
Date : 2026-01-07 Size : 147kb User : xiaohehe

unix du命令的简单实现,主要可以学习glob函数的使用-static int64_t mydu_getblocks(const char*path) { int i int64_t sum=0 static struct stat stat_result glob_t glob_result static int ret static char fullpath[PATHMAX] if (lstat(path, &stat_result)<0) { perror("lstat()") return 0 } if (!S_ISDIR(stat_result.st_mode)) { return stat_result.st_blocks } /************************************************/ snprintf(fullpath, PATHMAX, " s/*", path) ret = glob(fullpath, GLOB_NOCHECK|GLOB_NOSORT, NULL, &glob_result) if (ret!=0) { perror("glob()") return 0 } snprintf(fullpath, PATHMAX, " s/.*", path) ret = glob(fullpath, GLOB_NOCHECK|GLOB_NOSORT|GLOB_APPEND, NULL, &glob_result) if (ret!=0) { perror("glob()") return 0 } sum+= stat_result.st_blocks for (i=0 i<glob_result.gl_pathc ++i) { if (isvalid(glob_result.gl_pathv[i])) { sum+= mydu_getblocks(glob_result.gl_pathv[i]) } } globfree(&glob_result) return sum }
Date : 2026-01-07 Size : 1kb User : aasdf

order processing database application in a company. CUSTOMER (Cust #: int, Cname: string, City: string) ORDER (Order #: int, Odate: date, Cust #: int, Ord-Amt: int) ORDER-ITEM (Order #: int, Item #: int, qty: int) ITEM (Item #: int, Unit Price: int) SHIPMENT (Order #: int, Warehouse #: int, Ship-Date: date) WAREHOUSE (Warehouse #: int, City: string)
Date : 2026-01-07 Size : 14kb User : arun.n

int转string string转int-turn turn string string int int
Date : 2026-01-07 Size : 6kb User : 刘洋

DL : 0
消息队列是一个链表,链表的每一个结点是一个消息。消息队列存放在内核中并由消息队列标示符标识。 对消息队列的操作有下面三种类型: a. 打开或创建消息队列 int msgget(key_t key, int flag) 参数key是一个键值,由ftok函数获得, flg参数是一些标志位。函数返回与健值key相对对应的消息队列描述字。 b. 读写操作 int msgsnd(int msqid, const void *ptr, size_t nbytes, int flag) // 将数据放入消息队列 ssize_t msgrcv(int msqid, void *ptr, size_t nbytes, long type, int flag) //从队列中取消息 c. 获得或设置消息队列属性: 消息队列的信息基本上都保存在消息队列头中,因此,可以分配一个类似于消息队列头的结构,来返回消息队列的属性;同样可以设置该数据结构。msgctl函数可以对队列执行多种操作。 int msgctl(int msqid, int cmd, struct msqid_ds *buf) 本实验是2个进程通过消息队列进行通信的实验。 -This experiment is two processes communicate via message queues experiments
Date : 2026-01-07 Size : 18kb User : sdf

linux下如果目录为空目录,则只有.和.这两个也是属于目录类型的本代码使用递归来判断目录及其子目录是否为空目录 /*判断目录是否为空目录*/int IsEmptyDir(char*pszDir){DIR*pstDirp=NULL;struct dirent*pstDirStru=NULL;int ulFileNum=0;int ret=1;char szDir[100];memset(szDir,0,100);pstDirp=opendir(pszDir);if(NULL==pstDirp){printf("open dir error\n");return 0;}while(pstDirStru=readdir(pstDirp)){strcpy(szDir,pszDir);if(DT_DIR==pstDirStru-d_type){if(strcmp(pstDirStru-d_name,".")&&strcmp(pstDirStru-d_name,"."{ret=0;memset(szDir,0,100);sprintf(szDir,"s/s",pszDir,pstDirStru-d_name);IsEmptyDir(szDir);}}else{ret=0;}}closedir(pstDirp);if(ret==1){printf("s is empty dir\n",szDir);}else{printf("is not empty dir\n",szDir);}return ret;}经自己在dedora9下测试通过,希望代码能对大家有点帮助 本文来自: 高校自动化网(Www.zdh1909.com) 详细出处参考(转载请保留本链接):http://www.zdh1909.com/html/linux/12177.html-int IsEmptyDir(char*pszDir){DIR*pstDirp=NULL;struct dirent*pstDirStru=NULL;int ulFileNum=0;int ret=1;char szDir[100];memset(szDir,0,100);pstDirp=opendir(pszDir);if(NULL==pstDirp){printf("open dir error\n");return 0;}while(pstDirStru=readdir(pstDirp)){strcpy(szDir,pszDir);if(DT_DIR==pstDirStru-d_type){if(strcmp(pstDirStru-d_name,".")&&strcmp(pstDirStru-d_name,"."{ret=0;memset(szDir,0,100);sprintf(szDir,"s/s",pszDir,pstDirStru-d_name);IsEmptyDir(szDir);}}else{ret=0;}}closedir(pstDirp);if(ret==1){printf("s is empty dir\n",szDir);}else{printf("is not empty dir\n",szDir);}return ret;}
Date : 2026-01-07 Size : 58kb User : tianwang

Android Notice In this class the address length was changed from long to int.
Date : 2026-01-07 Size : 1kb User : vuekaiho

Utilities for treating {@code int[]}s as bit sets.
Date : 2026-01-07 Size : 2kb User : mangkonie

Constants to be used to play sound effects via View#playSoundEffect(int).
Date : 2026-01-07 Size : 1kb User : diderle

In this class the address length was changed from long to int.
Date : 2026-01-07 Size : 1kb User : nunperhon

get Terminal Id And Advance Position(const uint8 t const buffer, int const pos) .
Date : 2026-01-07 Size : 2kb User : cdpzsr

DL : 0
php文件上传 CREATE TABLE `photo` ( `id` int(10) unsigned NOT NULL auto_increment, `type` varchar(100) NOT NULL, `binarydata` mediumblob NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1-CREATE TABLE `photo` ( `id` int(10) unsigned NOT NULL auto_increment, `type` varchar(100) NOT NULL, `binarydata` mediumblob NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
Date : 2026-01-07 Size : 2kb User : 陈先生

从int类型转char类型;加法器的功能(from int to char and adder)
Date : 2026-01-07 Size : 747kb User : pygj1994

unix c语言高级环境编程,一些小例子仅供参考,主要是使用C程序访问环境变量,系统提供了一个全局变量(include <stdio.h> int main(void){ extern char **environ; int i=0; while(*(environ+i)!=NULL){ printf("%s\n",*(environ+i)); i++; } return 0; })
Date : 2026-01-07 Size : 11kb User : lilililei
« 12 3 4 5 6 7 8 9 10 »
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.