CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C语言

有那位帮我解释一下!!ch = getchar() !!!!!

楼主yc0188(守护瓶(萍))2004-12-04 12:32:51 在 C/C++ / C语言 提问

---   e:\my   documents\visual   studio   projects\test_5\test_5.cpp   -------------------  
            1:   #include   <stdio.h>  
            2:   #include   <conio.h>  
            3:    
            4:   int   main()  
            5:   {  
  00411A50     push                 ebp      
  00411A51     mov                   ebp,esp    
  00411A53     sub                   esp,0D0h    
  00411A59     push                 ebx      
  00411A5A     push                 esi      
  00411A5B     push                 edi      
  00411A5C     lea                   edi,[ebp-0D0h]    
  00411A62     mov                   ecx,34h    
  00411A67     mov                   eax,0CCCCCCCCh    
  00411A6C     rep   stos         dword   ptr   [edi]    
            6:   char   ch;  
            7:   ch   =   getchar();  
  00411A6E     mov                   eax,dword   ptr   [__iob+4   (428B44h)]    
  00411A73     sub                   eax,1    
  00411A76     mov                   dword   ptr   [__iob+4   (428B44h)],eax    
  00411A7B     js                     main+51h   (411AA1h)    
  00411A7D     mov                   ecx,dword   ptr   [__iob   (428B40h)]    
  00411A83     movsx               edx,byte   ptr   [ecx]    
  00411A86     and                   edx,0FFh    
  00411A8C     mov                   dword   ptr   [ebp-0D0h],edx    
  00411A92     mov                   eax,dword   ptr   [__iob   (428B40h)]    
  00411A97     add                   eax,1    
  00411A9A     mov                   dword   ptr   [__iob   (428B40h)],eax    
  00411A9F     jmp                   main+64h   (411AB4h)    
  00411AA1     push                 offset   __iob   (428B40h)    
  00411AA6     call                 @ILT+730(__filbuf)   (4112DFh)    
  00411AAB     add                   esp,4    
  00411AAE     mov                   dword   ptr   [ebp-0D0h],eax    
  00411AB4     mov                   cl,byte   ptr   [ebp-0D0h]    
  00411ABA     mov                   byte   ptr   [ch],cl    
            8:   return   0;  
  00411ABD     xor                   eax,eax    
            9:   }  
  00411ABF     pop                   edi      
  00411AC0     pop                   esi      
  00411AC1     pop                   ebx      
  00411AC2     add                   esp,0D0h    
  00411AC8     cmp                   ebp,esp    
  00411ACA     call                 @ILT+950(__RTC_CheckEsp)   (4113BBh)    
  00411ACF     mov                   esp,ebp    
  00411AD1     pop                   ebp      
  00411AD2     ret  
   
  7:   ch   =   getchar();   到底为我们做了什么?汇编的操作是什么意思?谢谢!!!! 问题点数:20、回复次数:6Top

1 楼yegaofei(踏雪而歌)回复于 2004-12-04 12:49:56 得分 2

我记得gethcar()就是从输入缓冲里取一个字符,并返回该字符Top

2 楼hcj2002(流浪者·躬自厚而薄责于人 )回复于 2004-12-04 13:10:03 得分 2

从stdin中读取一个字符。Top

3 楼sharkhuang(走吧走吧!人总会慢慢长大~)回复于 2004-12-04 13:13:49 得分 10

 
  Administrator@SZ-CS-SHARKH1   ~  
  $   man   getchar  
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
  getchar(3)                                                                                           getchar(3)  
   
  NAME  
                getchar   -   read   a   character   (macro)  
   
  ANSI_SYNOPSIS  
                #include   <stdio.h>  
                int   getchar(void);  
   
                int   _getchar_r(void   *   reent);  
   
  TRAD_SYNOPSIS  
                #include   <stdio.h>  
                int   getchar();  
   
                int   _getchar_r(   reent)  
                char   *   reent;  
   
  DESCRIPTION  
                getchar     is     a     macro,     defined     in     stdio.h.     You   can   use  
                getchar   to   get   the   next   single   character   from   the   standard  
                input     stream.       As     a     side     effect,   getchar   advances   the  
                standard   input's   current   position   indicator.  
   
                The   alternate   function   _getchar_r   is   a   reentrant     version.  
                The     extra     argument     reent     is     a   pointer   to   a   reentrancy  
                structure.  
   
  RETURNS  
                The   next   character   (read   as   an   unsignedchar,   and     cast     to  
                int),     unless     there     is     no   more   data,   or   the   host   system  
                reports   a   read     error;     in     either     of     these     situations,  
                getchar   returns   EOF.  
   
                You     can     distinguish   the   two   situations   that   cause   an   EOF  
                result   by   using   `   ferror(stdin)'   and   `   feof(stdin)'.  
   
  PORTABILITY  
                ANSI     C     requires     getchar;     it     suggests,     but     does     not  
                require,   that   getchar   be   implemented   as   a   macro.  
   
                Supporting     OS   subroutines   required:   close,   fstat,   isatty,  
                lseek,   read,   sbrk,   write.  
   
  SOURCE  
                src/newlib/libc/stdio/getchar.c  
   
                                                                                                                getchar(3)  
  (END)Top

4 楼williamVII(spread)回复于 2004-12-04 16:23:05 得分 2

how?Top

5 楼Flood1984(峰子)回复于 2004-12-04 17:10:56 得分 2

getchar();  
  从标准输入设备读取一个字符,并返回字符的ASCII值Top

6 楼sun428(Born to Win)回复于 2004-12-11 12:03:31 得分 2

getchar    
  功   能:   从stdin流中读字符Top

相关问题

  • 那位老师给解释解释
  • 那位高手为我解释一下
  • 那位能具体解释一下SetWindowsHookEx
  • 请那位大哥给个解释吧!!
  • 那位解释一下“.”操作符
  • 小弟纯属菜鸟一只,那位老师给解释解释!!!
  • 那位能给小弟解释解释这几个东东 刚接触B/S!!
  • 那位大哥帮帮忙,解释一下关于命令(fullscren)?  
  • 那位师兄解释一下,50分送上!
  • 那位朋友帮忙解释几句洋文

关键词

  • getchar
  • iob
  • reent
  • ebp
  • dword ptr
  • mov
  • esp
  • ch
  • eax
  • edi

得分解答快速导航

  • 帖主:yc0188
  • yegaofei
  • hcj2002
  • sharkhuang
  • williamVII
  • Flood1984
  • sun428

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo