输入输出流和错误流

来源:互联网 发布:mac版itunes铃声 编辑:程序博客网 时间:2024/06/11 09:29
#include<stdio.h>/**stdin标准输入流stdout输出流stderr错误流*/int main(){ /* printf("hello world!");  int a;  scanf("%d",&a);  printf("input value is :%d",a);*/ //    fprintf(stdout,"plese input the value a:\n");//等价于printf("plese input the value a:\n");    int a;   // scanf("%d",&a);等价下下面  默认从键盘获得,也可以修改参数,从打印机获得   fscanf(stdin,"%d",&a);   if(a<0){    fprintf(stderr,"the value must >0");    return 1;}   fscanf(stdin,"%d",&a); return 0;}`