Hello.c可执行程序的生成
实验要求:在不同OS下(windows,linux)编写hello.c程序,进行编译、链接,最终生成可执行代码。2、给出可执行代码的内容(用十六进制表示);主要是不太懂第二问这个怎么表示。麻烦各位大神解答,十分感谢
#include <stdio.h>
#include <unistd.h>
int main (int argc, char **argv)
{
int oc; /*选项字符 */
char *b_opt_arg; /*选项参数字串 */
while((oc = getopt(argc, argv, "n:")) != -1)
{
switch(oc)
{
case 'n':
b_opt_arg = optarg;
break;
}
}
printf("hello world : %s
",b_opt_arg);
return 0;
}
运行结果:
# ./hello -n 3
hello world : 3
上一篇:加入时间戳有什么用,如何加时间戳
热门标签: