So in general, when you're running command line programs, they can take input or arguments or parameters or switches or flags.
一般而言,当你运行命令行程序时,可以把把这些当做输入,像什么参数啊,或开关啊,或标志啊等等。
s1 It's a little square, it's going to be called s1 and that's what exists as of line two of this program, GetSting but now I've called get string.
这是一个正方形,叫做1,这就是程序中第二行代码所表示的,现在我调用。
I don't have to go read what it printed out in the screen. This has returned a value that I can use. Because I could do a test to say, is this a return value? If it's not, I'll do something else with it. So the binding is still there, it simply doesn't print it out.
我不想读到屏幕中打印出来的这行字,程序返回过一个我能够使用的值,因为我可以做个小测试,来说明这是否是返回的值,如果不是,我可以做一些其它的事,而这个绑定依然在这儿,没有打印任何东西。
So all of these programs or commands that we've been using thus far for the piece set in class, take what we call command line arguments, they are the zero or more words that follow the program's name.
所有我们一直在课堂上使用的,这些程序或者命令,携带着命令行参数,它们是跟在,程序名的后面的一个或多个单词。
And the means by which I connect to the so called cloud is with a command line program or GUI program.
连接到所谓的“云“上,方法是一条命令行程序,或GUI程序。
Go ahead and recite for us line 2 of this program.
我们看看程序的第二行。
nano Well, anytime you run a program at the command line, like nano, you've almost always been putting one or more words nano hello c GCC hello c after that program's name; nano hello dot C, GCC hello dot C, and any number of MKDIR for make directory, and then peace at one or similar.
好的,任何时候在命令行中运行一个程序,就像,你几乎总是用1个或多个单词,在程序名的后面,许多的建立一个新的子目录,然后恢复平静。
Because as you'll soon find, when you're writing programs 0 that aren't just four lines long but are 40 or 400 which very quickly becomes easy, you'll find that even you the next morning have no idea what this code does for whatever reason, and just having some English comments is a huge boon to comprehension for yourself and others.
你们自己写程序时就会发现,用40行甚至400行代码来代替繁杂拥挤的4行代码0,将会让事情简化许多,你会发现,即使由于某些原因,你不知道如何写代码,先写些注释,于人于己,都是好事,易于理解嘛。
It's just hard to keep track of them at first but they all generally mean the same thing, provide additional input to this program called GCC by just specifying it on the command line.
刚开始是很难理解这些词的,但其实都是一个意思,所以,只要在命令行上为这个程序,再添加一个名曰GCC的输入就OK啦。
- You then run a compiler, in our case called "GCC" -- -- one of the world's most popular -- and then you can run it with some number of switches, these command line arguments as they're called that somehow influences the behavior of this program.
然后你们运行编译器,在这里我们使用叫做“GCC“的编译器-,这是全球最流行的-,然后你们可以通过一些命令来运行这个编译器,这些命令行参数可以,影响这个程序的行为。
Well it's a stupid looking program, but because I had more new line characters, and because I was using percent C, for individual characters, one per line, now I'm seeing dot slash ARG V2, well, now if I go ahead and rerun this with foo, I get this effect as well.
这是一个看起来很笨的程序,但是因为我有更多的新行代码,因为我使用的是%c,为单个字符使用的,每一行一个,现在我看到的是,/argv2,好的,现在如果我继续用foo返回它,我产生了这样的效果。
So here is the simplest program which is perhaps an ironic statement that you can implement with this language called C. So it takes a few lines of code to actually get something up and running and as you'll recall last Friday, I didn't even get this up and running because part of the process of writing a program is to one, write it.
让我们回到这个最简单的程序,你们也许觉得啼笑皆非,这么简单的例子,用C语言写出来就可以了嘛,的确只需要几行代码,就可以让这个程序跑起来,就像上周五的那样,我之所以没让它跑起来,因为编程步骤之一,就是“写“
应用推荐