码迷,mamicode.com
首页 > 系统相关 > 详细

Linux C - 环境

时间:2017-09-13 00:35:04      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:str   字符串数组   pre   logs   argv   linux c   linu   nbsp   参数   

 

程序参数

/* 带参数的main函数 */

int main(int argc, char * argv[])  

argc 是程序参数的个数

argv是一个代表参数自的字符串数组

 

例如:

$ myprog left rigth "and center"

程序 myprog 将从main函数开始, main带的参数是:

argc: 4

argv: {"myprog", "left", "rigth", "and center"}

 

getopt 函数

#include <unistd.h>

int getopt(int argc, char *const argv[], const char *optstring);
extern char *optarg;
extern int optind, opterr, optopt;

 

 

 

环境变量

 

Linux C - 环境

标签:str   字符串数组   pre   logs   argv   linux c   linu   nbsp   参数   

原文地址:http://www.cnblogs.com/elewei/p/7512756.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!