1 Star 0 Fork 0

kzy111/Linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Terminal.hpp 436 Bytes
一键复制 编辑 原始数据 按行查看 历史
kzy111 提交于 2024-06-10 09:52 +08:00 . ud
#include <iostream>
#include <string>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
std::string terminal = "/dev/pts/6";
int OpenTerminal()
{
int fd = open(terminal.c_str(), O_WRONLY);
if(fd < 0)
{
std::cerr << "open terminal error" << std::endl;
return 1;
}
dup2(fd, 2);
// printf("hello world\n");
// close(fd);
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/kzy111/linux.git
git@gitee.com:kzy111/linux.git
kzy111
linux
Linux
master

搜索帮助