c - 将system()函数的显示传递给一个fifo
问题描述
我想在 fifo 中传递 system() 函数执行的显示,以便能够在另一个终端上显示它,我尝试了 a 但它给了我一个分段错误
void executeFile(char* sourcefname,struct Info_FIFO_Transaction donnees){
char *nomFichier, *sp;
char command[100];
int client_fifo_fd;
char client_fifo[400];
sprintf(client_fifo, CLIENT_FIFO_NAME, donnees.pid_client);
client_fifo_fd = open(client_fifo, O_WRONLY);
nomFichier = strtok_r(sourcefname, ".", &sp);
sprintf(command,"gcc -o fichCVSEXE%s %s.c\n",nomFichier,nomFichier);
// execution of file
strcat(donnees.transaction ,system(command));
if(client_fifo_fd!=-1){
write(client_fifo_fd, &donnees, sizeof(donnees));
close(client_fifo_fd);}
}
解决方案
推荐阅读
- jquery - 从列表中获取键和值以将默认值放入 Select2 4.0.3
- angular - Flex Layout 内容显示不准确
- javascript - 如何将 Javascript 函数调用传递给 PHP 中的变量
- php - laravel:转换为 json 时缺少 Eloquent all() 数据
- angular - 使用函数在 Firebase 上提供 i18n Angular 应用程序
- dart - 在 IntelliJ IDE 中运行 Dart 示例项目时出错
- firebase - 将 BuildFire 与 Firebase api 集成
- c# - 如何在水晶报表中导出到excel时重新格式化子报表链接
- craftcms - 向管理面板添加新的客户端字段并进行管理
- javascript - 数组作为键和值,但值未定义