|
|
|
تازه اول راهه
        
گروه: کاربران
آخرین بازدید: دوشنبه 29 اسفند 1384 - 3:58 بعدازظهر
پست ها: 1,
بازدید ها: 1
|
|
|
با عرض سلام و خسته نباشید خدمت شما دوستان بسیار عزیز . لطفا اگه ممکنه شکل کلی همه دستورات مربوط به فایل هادر دلفی و کمی توضیح درباره آنها و یک مثال درباره آنها را برای من بفرستید. ویک سایت و یک کتاب درباره امکانات فایل ومدیریت فایل در دلفی به من معرفی کنید. اگه امکان دارد این کاررا سریع انجام دهید خیلی عجله دارم. دیکه فکر می کنم تقاضاهایم خیلی زیاد شد. با تشکر بسیار بسیار فراوان.
|
|
|
|
|
کارش درسته
        
گروه: مدیر ارشد
آخرین بازدید: چهار شنبه 29 آبان 1387 - 4:18 بعدازظهر
پست ها: 2,106,
بازدید ها: 2,292
|
|
راهنمای دلفی واقعاْ کامله ولی گفتم شاید بهش دسترسی نداشته باشی این قسمتشو اینجا گذاشتم
File Input and Output The table below lists input and output routines. Input and output procedures and functions Procedure or function Description System.Append Opens an existing text file for appending. System.AssignFile Assigns the name of an external file to a file variable. System.BlockRead Reads one or more records from an untyped file. System.BlockWrite Writes one or more records into an untyped file. System.ChDir Changes the current directory. System.CloseFile Closes an open file. System.Eof Returns the end-of-file status of a file. System.Eoln Returns the end-of-line status of a text file. System.Erase Erases an external file. System.FilePos Returns the current file position of a typed or untyped file. System.FileSize Returns the current size of a file; not used for text files. System.Flush Flushes the buffer of an output text file. System.GetDir Returns the current directory of a specified drive. System.IOResult Returns an integer value that is the status of the last I/O function performed. System.MkDir Creates a subdirectory. System.Read Reads one or more values from a file into one or more variables. System.Readln Does what Read does and then skips to beginning of next line in the text file. System.Rename Renames an external file. System.Reset Opens an existing file. System.Rewrite Creates and opens a new file. System.RmDir Removes an empty subdirectory. System.Seek Moves the current position of a typed or untyped file to a specified component. Not used with text files. System.SeekEof Returns the end-of-file status of a text file. System.SeekEoln Returns the end-of-line status of a text file. System.SetTextBuf Assigns an I/O buffer to a text file. System.Truncate Truncates a typed or untyped file at the current file position. System.Write Writes one or more values to a file. System.Writeln Does the same as Write, and then writes an end-of-line marker to the text file.
A file variable is any variable whose type is a file type. There are three classes of file: typed, text, and untyped. The syntax for declaring file types is given in File types. Note that file types are only available on the Win32 platform. Before a file variable can be used, it must be associated with an external file through a call to the System.AssignFile procedure. An external file is typically a named disk file, but it can also be a device, such as the keyboard or the display. The external file stores the information written to the file or supplies the information read from the file. Once the association with an external file is established, the file variable must be opened to prepare it for input or output. An existing file can be opened via the System.Reset procedure, and a new file can be created and opened via the System.Rewrite procedure. Text files opened with System.Reset are read-only and text files opened with System.Rewrite and System.Append are write-only. Typed files and untyped files always allow both reading and writing regardless of whether they were opened with System.Reset or System.Rewrite . Every file is a linear sequence of components, each of which has the component type (or record type) of the file. The components are numbered starting with zero. Files are normally accessed sequentially. That is, when a component is read using the standard procedure System.Read or written using the standard procedure System.Write , the current file position moves to the next numerically ordered file component. Typed files and untyped files can also be accessed randomly through the standard procedure System.Seek , which moves the current file position to a specified component. The standard functions System.FilePos and System.FileSize can be used to determine the current file position and the current file size. When a program completes processing a file, the file must be closed using the standard procedure System.CloseFile . After a file is closed, its associated external file is updated. The file variable can then be associated with another external file. By default, all calls to standard I/O procedures and functions are automatically checked for errors, and if an error occurs an exception is raised (or the program is terminated if exception handling is not enabled). This automatic checking can be turned on and off using the {$I+} and {$I-} compiler directives. When I/O checking is off, that is, when a procedure or function call is compiled in the {$I-} state an I/O error doesn't cause an exception to be raised; to check the result of an I/O operation, you must call the standard function System.IOResult instead. You must call the System.IOResult function to clear an error, even if you aren't interested in the error. If you don't clear an error and {$I-} is the current state, the next I/O function call will fail with the lingering System.IOResult error. Text Files This section summarizes I/O using file variables of the standard type Text. When a text file is opened, the external file is interpreted in a special way: It is considered to represent a sequence of characters formatted into lines, where each line is terminated by an end-of-line marker (a carriage-return character, possibly followed by a line feed character). The type Text is distinct from the type file of Char. For text files, there are special forms of System.Read and System.Write that let you read and write values that are not of type Char. Such values are automatically translated to and from their character representation. For example, Read(F, I), where I is a type Integer variable, reads a sequence of digits, interprets that sequence as a decimal integer, and stores it in I. There are two standard text file variables, System.Input and System.Output The standard file variable System.Input is a read-only file associated with the operating system's standard input (typically, the keyboard). The standard file variable System.Output is a write-only file associated with the operating system's standard output (typically, the display). Before an application begins executing, System.Input and System.Output are automatically opened, as if the following statements were executed: AssignFile(Input, ''); Reset(Input); AssignFile(Output, ''); Rewrite(Output); Note: For Win32 applications, text-oriented I/O is available only in console applications, that is, applications compiled with the Generate console application option checked on the Linker page of the Project Options dialog box or with the -cc command-line compiler option. In a GUI (non-console) application, any attempt to read or write using System.Input or System.Output will produce an I/O error.
Some of the standard I/O routines that work on text files don't need to have a file variable explicitly given as a parameter. If the file parameter is omitted, System.Input or System.Output is assumed by default, depending on whether the procedure or function is input- or output-oriented. For example, Read(X) corresponds to Read(Input, X) and Write(X) corresponds to Write(Output, X). If you do specify a file when calling one of the input or output routines that work on text files, the file must be associated with an external file using System.AssignFile, and opened using System.Reset, System.Rewrite, or System.Append. An error occurs if you pass a file that was opened with System.Reset to an output-oriented procedure or function. An error also occurs if you pass a file that was opened with System.Rewrite or System.Append to an input-oriented procedure or function. Untyped Files Untyped files are low-level I/O channels used primarily for direct access to disk files regardless of type and structuring. An untyped file is declared with the word file and nothing more. For example, [Delphi]var DataFile: file; For untyped files, the System.Reset and System.Rewrite procedures allow an extra parameter to specify the record size used in data transfers. For historical reasons, the default record size is 128 bytes. A record size of 1 is the only value that correctly reflects the exact size of any file. (No partial records are possible when the record size is 1.) Except for System.Read and System.Write, all typed-file standard procedures and functions are also allowed on untyped files. Instead of System.Read and System.Write, two procedures called System.BlockRead and System.BlockWrite are used for high-speed data transfers.
|
|
|
|
|
تازه اول راهه
        
گروه: کاربران
آخرین بازدید: سه شنبه 15 آبان 1386 - 12:53 بعدازظهر
پست ها: 18,
بازدید ها: 18
|
|
یه سایت عالی در باره کار با فایلها :
|
|
|
|