无法打开/ dev /控制台

编程入门 行业动态 更新时间:2024-10-23 10:27:53
本文介绍了无法打开/ dev /控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 // console = fopen("con", "wt"); this worked under windows // console = fopen("/dev/console", "wt"); segmentation fault console = fopen("/dev/tty0", "wt"); returns zero

C语言编写,使用薄荷Linux操作系统。我想谈的控制台,无论标准输入和放大器的重定向;标准输出。

Writing in C, using Mint Linux. I want to talk to the console regardless of redirection of stdin & stdout.

推荐答案

的的/ dev /控制台设备并不一定提供给您。对于Linux,如果你碰巧看到当前虚拟终端该设备只能显示出任何结果。另外(包括Linux),对于大多数系统的/ dev /控制台需要提升的权限来打开它,例如,你的应用程序作为根。其原因是因为有些系统消息被写入到系统控制台。

The /dev/console device is not necessarily available to you. For Linux that device would only show any result if you happen to look at the current virtual terminal. Also (including Linux), for most systems /dev/console requires elevated permissions to open it, e.g., your application is running as root. The reason for that is because some system messages are written to the system console.

有关进一步的讨论,这里有几个链接:

For further discussion, here are a few links:

  • Linux:为/ dev /控制台之间的差异,为/ dev / tty的和/ dev / tty0的
  • 7。终端专项文件例如/ dev / tty的从文本的终端HOW-TO
  • 谅解/从Linux杂志dev的
  • Linux: Difference between /dev/console , /dev/tty and /dev/tty0
  • 7. Terminal Special Files such as /dev/tty from Text-Terminal HOW-TO
  • Understanding /dev from Linux Journal

更多推荐

无法打开/ dev /控制台

本文发布于:2023-10-27 15:58:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533852.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   无法打开   dev

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!