高手赐教!!急!!tornado2.0

sclarkca810619 2003-10-04 04:09:15
小弟不知道select()怎么用!在tornado2.0下的程序!
#include "vxWorks.h"
#include "selectLib.h"
#include "fcntl.h"
#include "stdlib.h"
#include "stdio.h"
#include "ioLib.h"
#include "pipeDrv.h"
#include "selectLib.h"
#define MAX_DATA 1024
#define MAX_MESSAGE 50
#define EVERMESSAGELONGTH 10
#define FIRST "first"
#define SECOND "second"
int task1();
int task2();
int i;
int firstID;
char buffer[MAX_DATA];
int width;
struct fd_set readFds;
struct fd_set writeFds;
int fds1;
int pipe()
{
pipeDrv ();
if((pipeDevCreate("first",MAX_MESSAGE,EVERMESSAGELONGTH)==ERROR))
{
printf("the pipe is failed\n");
}
else
{
printf("the pipe have been created successfully\n");
}
if (select (10, &readFds,&writeFds, NULL, 120) == ERROR)
{
printf("the select is wrong\n");
}
else
{
firstID=taskSpawn("firsttask",90,0x000,2000,task1,0,0,0,0,0,0,0,0,0,0);
fds1=fds1+5;
printf("the fds1 is changed,now it is:\n");
printf("%d",fds1);
}

}

int task1()
{

if((fds1= open ("first", O_RDWR,0644))==ERROR)
{
printf("the file is opened FAILED\n");
}
else
{
printf("the file is opened sucessful\n");
printf("the original fds1,it is:\n");
printf("%d",fds1);
}
FD_ZERO (&readFds);
FD_SET (fds1,&readFds);
read (fds1, buffer, 10);

}
/*int task2()
{
}*/
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fiddleman 2003-11-09
  • 打赏
  • 举报
回复
BT陈?帮你UP~~~

liupengfei81 2003-10-05
  • 打赏
  • 举报
回复
up

21,618

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧