[C] LINUX C 编程dup2问题
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
void get_cal(const char *arg)
{
char cmd[64];
strcpy(cmd, arg);
int pfds[2],bak_stdout;
if(pipe(pfds)==0)
{
printf("2\n");
printf("fd_11 is %d\n",pfds[1]);
printf("2.1\n");
bak_stdout=dup(1);
printf("2.1.1\n");
// close(1);
printf("2.1.1.1\n");
dup2( pfds[1], 1);
close(pfds[0]);
printf("1.2\n");
system(cmd);
close(pfds[1]);
dup2(bak_stdout,1);
}
else
printf("pipe open error!\n");
}
void read_cal(char *data)
{
char cmd[64], line[199];
*data = 0;
int pfds[2];
if(pipe(pfds)==0)
相关问答:
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
两个文件1.PC,1.inc
1.PC有操作oracle数据库的 ,1.inc也有操作oracle数据库
在其他数据中如informix 中$include 1.inc就可以使用了
在ORACLE数据库重 $include 1.inc不可用 EXEC SQL include 1.inc也不可 ......
我这里有一个登陆WIFI网络的页面。由于WIFI经常断线,所以要反复地在这个网页上登陆,没法无人值守。
所以,我想做一个C#程序,放一个webbrowser控件,自动填表并自动点击提交按钮。
问题一:
基本照网上找的程序 ......