如何使用cmd或powershell将键盘输入的值保存在记事本文件中 [英] How do I save the keyboard entered value in a notepad file using cmd or powershell

查看:488
本文介绍了如何使用cmd或powershell将键盘输入的值保存在记事本文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在.txt文件中保存以下C程序的完整输出。



I want to save the full output of the below C program in a .txt file.

#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c;

printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);

c = a + b;

printf("Sum of entered numbers = %d\n",c);
getch();

}





我在cmd提示符下使用了以下命令。但它只显示printf值而不保存scanf值(键盘插入值)。





I used the following commands in cmd prompt. But it just shows the printf value alone and not save the scanf value(the keyboard inserted value).

C:\Programs\Ramkumar>sample.exe /all > file.txt





任何人都可以提供完整输出的命令以保存在txt文件中。



提前致谢。



Can anyone provide me the command for the full output to save in txt file.

Thanks in advance.

推荐答案

这篇关于如何使用cmd或powershell将键盘输入的值保存在记事本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆