This week,the legislature passed a new anti-file-sharing amendment - the latest to the basic copyright law.
VOA: standard.2009.04.23
stdio h It pretty much means open this file, standard IO dot H and just paste its contents right here.
它的大致上的意思是打开这个文件,然后把它的内容粘贴在那里。
And this is because as you start writing--saving files to your hard drive, what happens is you might save this file here, then this one, then this one, then this one, but very reasonably you might go back eventually and delete this one.
这是因为当你开始对硬盘驱动器进行读写时,你可以保存一个文件到磁盘的某处,然后再一个,再一个,又一个,最后你可能回到这,并删除这一个文件。
This is a little file I created, all right, and I'm going to start with a sequence of these things and walk them along, again I invite you to put comments on that handout so that you can follow what we're going to do. All right?
这是我创建的一个小文件,好,然后我回去以一系列这样的事情,开始然后进行下去,我还是想大家都在手册上做一些注释,这样我们就能对将要做的事情,做一个记录了,对不对?
So, we actually didn't really know this that couldn't file their financial statements on time.
所以,实际上我们知道这件事情直到,它没有能够及时发布财务报表。
For some reason, at the top of this file, I've also included what I've called a function prototype.
因为一些原因,在这个文件顶端,我包含了一个函数原型。
Let's look at a version two of this file.
看看这个文件的第二个版本。
stdio h This file here is called standard I/O or stdio.h and this is just another text file someone else wrote many years ago and by using that line of code there, I'm telling the computer, give me acces to this code that this other person wrote that's in that file.
在这里的头文件称为标准输入输出文件或,这是由某位前人编写的文本文件,我们只需要刚才所述的一行代码,就能告诉电脑,让我连接到,这个前人在那个文件中写的代码。
Because what you don't see in this file is any code a that actually says put a letter of the alphabet at the top left hand corner of the screen and then put the next character to the right in other words, I'm taking for granted at this moment in time that my computer knows how to print something to the screen.
就是这些你在本文件中看不到的一些代码,实现了将首字母,放在屏幕的左上角,然后把其他字母加在其右边,我想当然地认为,我的电脑知道如何打印相应信息到屏幕上。
So I'm saving this file, notice there is a few keywords that we'll come back to next week like main which is kind of the main part of my program.
保存此文件,注意这有几个关键字,我们在下周介绍,比如代表程序主体部分的“main“
So those are in fact the patterns of zeroes and ones, the bytes that would have been outputted had I hello c remembered to download the compiler to this computer and run it on that little hello.c file.
这些都是0和1的模式,如果我记得下载编译器到计算机上的话,我们就能运行下这个,然后看看输出的字节。
So I've got one more piece of bad code on this point and this is buggy five dot c. So as a comment on top bug of this file challenges, what is, in fact, the bug.
所以我在这里得到了一块很烂的代码,这个是buggy5,c,所以作为这个文件顶端的注释,那实际上是那个。
So if I open this file, notice I just did "%d."
所以如果我打开这个文件,请注意我这里有“%d“
When I said in Week One that you don't actually have zeros and ones inside this header file; right?
在第一周我说过的,我们在这个头文件中,是没有二进制的,是吗?
It's instead outside of them and, by convention, at the top of the file so that I can access it anywhere, whether or not this is a good thing, remains to be seen.
它在函数的外面,按照惯例,在文件的顶端,所以我可以在任何地方使用它,不管这是不是好事情,拭目以待。
You write the source code, the stuff that looks like this and then you save your file, and now you just have a text file.
比如你们写出像这样的源代码后,保存,你将会得到一个文本文件。
Right now, this is just a text file. OK.
好,这就是一个文本文件,好。
So I'm gonna go ahead and save this file, hello c it's hello.c, dot C hints at the fact that this program I just whipped up is written in a language called C.
所以我打算继续,保存,并命名为,“,c“表明这个程序,是使用C语言写的。
Every file or program that you see here in this packet is alphabetically listed.
你们看到的所有的文件或程序,都会在这里按字母表顺序一一列出。
This is a keyword to Python that says, when it reads this in the file, it says, I'm creating a definition.
这是Python语言的关键词,当你在文件中读到这个词的时候,它的意思就是我正在创建一个定义。
include cs50 h But this says include and this says include a file called cs50.h that lives in some special place on the server that the cs50 staff wrote.
这里写在,众所周知,cs50,h是由CS50的员工,编写的一个库文件。
It takes an int; deal with it when you get to it and then once you look through the whole file, should you find -- ultimately find the actual code that defines or impliments this thing.
它携带一个int数,当你获得了它就处理它,然后一旦你查看整个文件,最终你将发现实际代码中,定义或执行了这个东西。
It's kind of a stupid lack of feature that this is the case, but notice that here is main, at the top of my file.
这是有点笨的,缺少特征的,就是这种情况,但是注意这里是main函数,在我的文件的顶端。
So this has created a file that just by convention happens to be called a.out.
至于为什么叫a,out?,约定而已。
This is a file called Holloway.c. This is-- to be clear, not a program.
这里有一个文件Holloway,c,不是程序-,我们马上就要清除掉它。
I mean, you'll play with it in great-- with great delight this semester, you will see that backslash N is the standard in any text file for creating what we know as new line characters.
我是指,这学期,你们会很高兴-,和它打交道,同时你们也会看到,在任何文本文件里,反斜杠n已经是,换行的代名词了。
I'm gonna call my file hello.c. There's a little bit GUI-- of distraction here but this is because this is not a GUI, CLI a graphical user interface, this is a CLI, command-line interface, which just means there are no windows and icons.
我先给我的文件命名为“hello,c“,你们也许会觉得有点烦,因为不是,图形用户界面,这是,命令行界面,这意味着没有窗口,没有图标。
LS And what very often happens if you do an LS in your account, to list your files, there's a whole lot of stuff in here at the moment -- and I don't have it here - but what you'll often see -- I'll just fake this demo -- is a file called core.
经常发生的是,如果你用你的账号做一个,来列出你的文件,此刻这里有一大堆元素,-它不在这里,但你们将经常看到--我将篡改这个演示-,是一个叫做core的文件。
So among your printout from Wednesday, if you have it, you have a file called math1.c. If you don't have this, the programs are short today, so it should be easy enough to follow along visually, but a PDF and the actual source code is available online for these things.
从你们周三打印出来的资料来看,如果你们手上有的话,你们会看到有个叫做的“math1,c“的文件,如果你们没有资料,那些程序还是比较短的,所以你们应该可以很轻松地,来看这些程序,但是那个PDF文件,和实际的源代码都可以到网上找到,相关的资料。
应用推荐