LinuxC下argv,argc[]的意义
MarkdownPad Document
*:first-child {
  margin-top: 0 !important;
}
body>*:last-child {
  margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
  margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
  margin: 20px 0 10px;
  padding: 0;
  font-weight: bold;
  -webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
  font-size: inherit;
}
h1 {
  font-size: 28px;
  color: #000;
}
h2 {
  font-size: 24px;
  border-bottom: 1px solid #ccc;
  color: #000;
}
h3 {
  font-size: 18px;
}
h4 {
  font-size: 16px;
}
h5 {
  font-size: 14px;
}
h6 {
  color: #777;
  font-size: 14px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
  margin-top: 0;
  padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
  margin-top: 0;
  padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
  margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
  color: #4183C4;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
  padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
  margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
  margin-bottom: 0;
}
dl {
  padding: 0;
}
dl dt {
  font-size: 14px;
  font-weight: bold;
  font-style: italic;
  padding: 0;
  margin: 15px 0 5px;
}
dl dt:first-child {
  padding: 0;
}
dl dt>:first-child {
  margin-top: 0px;
}
dl dt>:last-child {
  margin-bottom: 0px;
}
dl dd {
  margin: 0 0 15px;
  padding: 0 15px;
}
dl dd>:first-child {
  margin-top: 0px;
}
dl dd>:last-child {
  margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
  font-size: 12px;
  font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
  margin: 0 0px;
  padding: 0px 0px;
  white-space: nowrap;
  border: 1px solid #eaeaea;
  background-color: #f8f8f8;
  border-radius: 3px;
}
pre>code {
  margin: 0;
  padding: 0;
  white-space: pre;
  border: none;
  background: transparent;
}
pre {
  background-color: #f8f8f8;
  border: 1px solid #ccc;
  font-size: 13px;
  line-height: 19px;
  overflow: auto;
  padding: 6px 10px;
  border-radius: 3px;
}
pre code, pre tt {
  background-color: transparent;
  border: none;
}
kbd {
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    background-color: #DDDDDD;
    background-image: linear-gradient(#F1F1F1, #DDDDDD);
    background-repeat: repeat-x;
    border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
    border-image: none;
    border-radius: 2px 2px 2px 2px;
    border-style: solid;
    border-width: 1px;
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
    line-height: 10px;
    padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
  border-left: 4px solid #DDD;
  padding: 0 15px;
  color: #777;
}
blockquote>:first-child {
  margin-top: 0px;
}
blockquote>:last-child {
  margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
  clear: both;
  margin: 15px 0;
  height: 0px;
  overflow: hidden;
  border: none;
  background: transparent;
  border-bottom: 4px solid #ddd;
  padding: 0;
}
/* TABLES
=============================================================================*/
table th {
  font-weight: bold;
}
table th, table td {
  border: 1px solid #ccc;
  padding: 6px 13px;
}
table tr {
  border-top: 1px solid #ccc;
  background-color: #fff;
}
table tr:nth-child(2n) {
  background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
  max-width: 100%
}
-->
LinuxC下argc,argv[ ]的意义
参考了http://blog.csdn.net/followingturing/article/details/7707584
还是根据实例来进行说明:
#include<stdio.h>
#include<stdlib.h> int main(int argc,char *argv[])
{
if(argc== || argc>)
{
printf("Please input the name of the file
you want to edit, for example:./edit fillen\n");
printf("argv[0] is %s\n",argv[]);
} if(argc==)
{
printf("Now EDIT %s\n",argv[]);
printf("argv[0] is %s\n",argv[]);
printf("argv[1] is %s\n",argv[]);
} exit();
}
- 通过gcc生成可执行文件edit如下: 
- 运行文件edit:./edit,如下: 
- 运行文件edit,并输入file.txt:  ./edit file.txt,如下: 
结论:
- argc 为外部命令参数的个数,因此
输入命令./edit时,argc==1; 
 输入命令./edit file.txt时,argc==2;
- argv[]为存储的命令,其中argv[0]即为可执行文件名;
 输入命令./edit时,argv[0]=="./edit"; 
 输入命令./edit file.txt时,argv[0]=="./edit",argv[1]=="file.txt";
2017-2-4 23:10;20
LinuxC下argv,argc[]的意义的更多相关文章
- 通过实例解释LinuxC下argc,argc[]的意义
		MarkdownPad Document html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,ab ... 
- linux 下各errno的意义(转)
		linux 下各errno的意义(转) 本文转自:http://blog.csdn.net/kofiory/article/details/5790409 strerror(errno):获取er ... 
- linux 下信号处理命令trap && linux下各种信号的意义
		1.用途说明 trap是一个shell内建命令,它用来在脚本中指定信号如何处理.比如,按Ctrl+C会使脚本终止执行,实际上系统发送了SIGINT信号给脚本进程,SIGINT信号的默认处理方式就是退出 ... 
- Linuxc - C语言下return 0的意义
		两条指令同时执行,前提是第一条指令返回0.否则不执行第二条指令. root@jiqing-virtual-machine:~/cspace/les3# gcc main.c -o main.out & ... 
- '假定以下程序经编译和连接后生成可执行文件PROG.EXE,如果在此可执行文件所在目录的DOS提示符下键入:PROG ABCDEFGH IJKL<回车>,则输出结果为(   ). void main( int argc, char *argv[])  { while(--argc>0)  cout<<argv[argc];  cout<<"\n";  }
		main(int argc,char *argv[])函数的两个形参,第一个int argc,是记录你输入在命令行(你题目中说的操作就是命令行输入)上的字符串个数:第二个*argv[]是个指针数组,存 ... 
- LinuxC下获取UDP包中的路由目的IP地址和头标识目的地址
		在接受到UDP包后,有时候我们需要根据所接收到得UDP包,获取它的路由目的IP地址和头标识目的地址. (一)主要的步骤: 在setsockopt中设置IP_PKTINFO,然后通过recvmsg来获取 ... 
- linux 下各errno的意义
		strerror(errno):获取errno对应的错误 #include <string.h> /* for strerror */ #include <errno.h> # ... 
- Liniux系统下目录的权限意义
		访问者及其基本权限 Linux系统内的文件访问者有三种身份,分别是: a) 文件和文件目录的所有者: u---User(所有权);b) 文件和文件目录的所有者所在的组的用户: g---Group;c) ... 
- Linux系统下目录的权限意义
		访问者及其基本权限 Linux系统内的文件访问者有三种身份,分别是: a) 文件和文件目录的所有者: u---User(所有权);b) 文件和文件目录的所有者所在的组的用户: g---Group;c) ... 
随机推荐
- Python 序列化与反序列化
			序列化是为了将内存中的字典.列表.集合以及各种对象,保存到一个文件中(字节流).而反序列化是将字节流转化回原始的对象的一个过程. json库 序列化:json.dumps() 反序列化:json.lo ... 
- 【Linux】解决Linux服务器内存不足问题
			在Linux服务器上使用Jmeter进行压测的时候,遇到了一个错误: 根据这里的提示: Java HotSpot(TM) -Bit Server VM warning: INFO: os::commi ... 
- Xlrd模块读取Excel文件数据
			Xlrd模块使用 excel文件样例: 
- JS高级---正则表达式其他方法的使用
			正则表达式其他方法的使用 正则表达式中:g 表示的是全局模式匹配 正则表达式中:i 表示的是忽略大小写 var str = "中国移动:10086,中国联通:10010,中国电信:10000 ... 
- 安装vmware tools后仍然不能拖拽文件
			运行/usr/bin/vmware-user文件 ./vmware-user 
- CodeForces 1144D
			原题https://vjudge.net/problem/CodeForces-1144D /*求序列就经过几次step变成同一个数, 其实能发现一个数经过step1或者step2变成相邻的数, 所以 ... 
- mac环境下,pycharm2018 配置 anaconda。
			2018版的pycharm与之前的版本在配置anaconda上流程略有不同.直接上图 1.新建工程,展开会看到系统默认的编译环境名叫virtualenv,是基于python3.5的环境(如果没有安装过 ... 
- Android 开发 ThreadPool(线程池) 总结
			本文是介绍线程池的基础篇. 一.线程池的作用 创建异步线程的弊端: 1.每次new Thread创建对象,导致性能变差. 2.缺乏统一的管理,可能导致无限制的线程运行,严重的后果就是OOM 或者死机. ... 
- WPF学习笔记五之MVVM
			1.概念 MVVM是Model-View-ViewModel的缩写形式,它通常被用于WPF或Silverlight开发.这三者之间的关系如下图所示 模型(Model) Model——可以理解为带有字段 ... 
- c++指针实例
			#include <iostream> using namespace std; int main () { ; // 实际变量的声明 int* ip; // 指针变量的声明 ip = & ... 
