因此,试图读取一个文件可能会出错。
如何读取一个文件,查询每一行吗?
要读取一个文件,文件必须首先被打开。
在9.1的时候我们就看到过如何打开和读取一个文件了。
当客户机读取一个文件之后,就对这个页面的内容进行扫描,这与索引程序的情况相同。
After a file is read by the client, the page could also be scanned for content, as in the case of an indexer.
它的功能是打开文件以便在二进制模式内读取一个文件对象,并在整个文件内进行读取。
Opens for reading a file object in binary mode and reads in the entire file.
我们在本节一开始就已经说过,我们要从文件系统中读取一个文件,然后使用ServiceMix把包含文件内容的电子邮件消息发送到某个电子邮件地址。
As we've explained at the beginning of this section we want to read a file from the file system and use ServiceMix to send an E-mail message using the file contents to a certain E-mail address.
作业将从一个平面文件中读取订单。
如果一个线程尝试读取某个文件,而另一个线程对其进行写访问,则可能会损坏数据。
If one thread attempts to read from a file whilst another is writing to it, the data may become corrupted.
这个函数从一个打开文件中读取数据。
如果使用一个或多个API读取XML,那么很明显的一个方法就是使用与之相同的API将XML写入文件。
If you read the XML with an API (or APIs), one quite obvious way to write XML to a file is to use that same API to write the XML.
在本小节中,我们将演示一个简单用例:读取一个XML文件并输出到OD f文档。
In this section, we demonstrate a simple use case: Read an XML file and output to an ODF document.
对于BAR文件中的每个文件,该方法获取文件名并建立一个流读取文件内容。
For every file contained in the BAR file, it obtains the file name and opens a stream for the file content.
第一个用于读取XML配置文件;第二个用于打印解组SOAP请求后收到的对象。
The first is used to read the XML configuration file; the second is used to print the object that is received after de-marshaling the SOAP request.
但是读取Excel文件只是一个开始。
目录读取促使XM创建一个带文件列表的XML文档,然后使用xslt样式表将该X ML文档转换成正确的web页面。
Directory reading causes XM to create an XML document with the list of files and then use an XSLT style sheet to turn it in the proper Web page.
您可能知道,UNIX系统为文件系统上的每一个对象记录一个atime,或称为访问时间,每次读取文件时,atime都会被更新。
As you probably know, UNIX systems record an atime, or access time, for each object on the filesystem that gets updated every time a file is read.
我的ThinkPadT60p 笔记本硬盘速度是 7200RPM,它读取一个7MB 的文件需要 用24秒。
On my ThinkPad T60p with a 7200RPM disk drive, it takes 24 seconds to read a 7MB file.
要读取数据,一个简单的data . php文件包含单个函数load_data。
To read the data, a simple data.php file contains a single function, load_data.
这时再创建一个convertGame.php PHP脚本,用于随机地选取文件并读取数据,然后创建一个返回给表单的实例。
You'll create a PHP script, convertGame.php, which chooses a file at random and reads in the data to create an instance to return to the form.
最后一列说明对该文件每次只读取一个字节。
The last column shows that the file is being read one byte at a time. Listing 5 shows the code that causes this.
该解析器从一个 .dia文件中读取数据,并将其写入一个SQL 文件和一个 C++源文件中。
The parser reads from one .dia file and writes to an SQL file and a C++ source file.
这行代码将创建一个与以上页面的连接,并允许您开始像读取一个本地文件一样读取它。
This line of code creates a connection to the page above and allows you to start reading it much like a local file.
如果没有可用的位置信息,这个脚本就会失败;如果成功,脚本将生成一个HTML文件,浏览器可以读取该文件来呈现一个地图。
This script can fail if no location information is available; but if it succeeds, an HTML file is generated that a browser can read to render the map.
清单5对此进行了研究,它打开两个文件——一个文件用于读取,另一个文件用于写入——并让父进程和子进程同时执行读取和写入。
Listing 5 investigates this by opening up two files — one for reading and one for writing — and having both the parent and the child read and write simultaneously.
在一个命令(- 0777)中读取整个文件时要小心,因为大型文件将耗尽所有内存。
Be careful when reading a full file in one command (-0777), because a large file will use up all your memory.
要得到一个特定用户的所有文件的列表,程序员必须首先从用户表中读取行,然后解析文件的文本,并为每个文件运行一个单独的SELECT语句。
To get a list of all the files for a particular user, the programmer must first read the row from the users table, then parse the file's text and run an individual SELECT statement for each file.
该函数将从一个文件中读取XML文档,然后以结构化数据输出的形式返回内容。
This function would read the XML documents from a file and return the contents as structured data output.
如您所预料的,第一个子例程读取XML文件,返回一个引用。
As you might expect, the first reads an XML file, returning a reference.
例如,- f开关通常用于告诉程序读取一个配置文件,这将因为该文件可能覆盖或者补充命令行上给出的选项而使处理变复杂。
For instance, the -f switch commonly used to tell a program to read a configuration file complicates the configuration because the file may override or supplement options given on the command line.
应用推荐