Understanding Unix/Linux Programming-用户程序:play_again0

本文介绍了一个简单的C语言程序,用于在游戏结束后询问玩家是否想重新开始游戏。程序通过命令行界面接收用户的输入,并根据用户的回答返回不同的值来指示是否进行重玩。
 1 /* play_again0.c
 2  * purpuse: ask if user wants another play 
 3  * returns: 0 -> yes , 1 -> no 
 4  */
 5  
 6  #include <stdio.h>
 7  #include <stdlib.h>
 8  #include <termios.h>
 9  
10  #define QUESTION "Do you want another play?"
11  
12  int get_response(char *);
13  
14  int main()
15  {
16      int response ;
17      response = get_response(QUESTION);
18      return response ;
19  }
20  
21  int get_response(char * qiz)
22  {
23      printf("%s(y/n)" , qiz);
24      while(1)
25      {
26          switch(getchar())
27          {
28              case 'y':
29              case 'Y': return 0 ;
30              case 'n': 
31              case 'N': return 1 ;
32          }
33      }
34  }

 

arm-buildroot-linux-gnueabi-gcc: WARNING: unsafe header/library path used in cross-compilation: '-I/usr/local/include' ../lib/tevent/tevent_req.c: In function '_tevent_req_create': ../lib/tevent/tevent_req.c:78:8: warning: implicit declaration of function 'talloc_pooled_object' [-Wimplicit-function-declaration] 78 | req = talloc_pooled_object( | ^~~~~~~~~~~~~~~~~~~~ ../lib/tevent/tevent_req.c:79:12: error: expected expression before 'struct' 79 | mem_ctx, struct tevent_req, 2, | ^~~~~~ The following command failed: arm-buildroot-linux-gnueabi-gcc -I../lib/zlib -DMAX_DEBUG_LEVEL=-1 -D__location__=\ -ffunction-sections -fdata-sections -I. -I/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3 -I/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3/../lib/popt -I/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3/../lib/iniparser/src -Iinclude -I./include -I. -I. -I./../lib/replace -I./librpc -I./.. -I./../lib/talloc -I./../lib/tevent -I../lib/tdb/include -DHAVE_CONFIG_H -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./librpc -I./.. -I./../lib/popt -I/usr/local/include -I/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3/lib -I.. -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3 -c ../lib/tevent/tevent_req.c -o ../lib/tevent/tevent_req.o Makefile:1675: recipe for target '../lib/tevent/tevent_req.o' failed make[4]: *** [../lib/tevent/tevent_req.o] Error 1 make[4]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3' Makefile:224: recipe for target '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built' failed make[3]: *** [/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built] Error 2 make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' package/Makefile:133: recipe for target 'package/feeds/iplatform/samba/compile' failed make[2]: *** [package/feeds/iplatform/samba/compile] Error 2 make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' /data/red-round3/red-round3/Iplatform/openwrt/include/toplevel.mk:184: recipe for target 'package/samba/compile' failed make[1]: *** [package/samba/compile] Error 2 make[1]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' Makefile:234: recipe for target 'iplatform_package/samba/compile' failed make: *** [iplatform_package/samba/compile] Error 2
最新发布
11-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值