找回密码
 注册
查看: 586|回复: 2

How to get keyboard iuput

[复制链接]
发表于 2003-8-2 07:03:01 | 显示全部楼层 |阅读模式
I am creating an open teaching meterial for high school programing
education in China.

In C command line environment under Linux, how can I get
keyboard input from the command line into a C program?

Thanks.
 楼主| 发表于 2003-8-3 01:13:48 | 显示全部楼层
Sorry, I fogot many things I learned years ago.

Actually, I can use getchar(), read(), getc(stdin), or maybe fscanf(stdin, ...).

The cin and cout are C++ stuff.
回复

使用道具 举报

发表于 2003-8-6 08:31:54 | 显示全部楼层
[code:1]
int main(int argc, char **argv) // argc是命令(参数)的个数,argv是字符串数组
                                // 比如ls /etc,argc = 2,argv[0]指向"ls" argv[1]指向"/etc"
{
        return 0;
}
[/code:1]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-8-11 12:09 , Processed in 0.023907 second(s), 16 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表