Форум: "Основная";
Текущий архив: 2002.10.21;
Скачать: [xml.tar.bz2];
ВнизTFileStream. How create file? Найти похожие ветки
← →
Asderg (2002-10-10 15:34) [0]делаем
TFileStream *fs=new TFileStream("c:\\blabla.bla", fmOpenWrite);
а если файла нету, как создать здесь?
← →
. (2002-10-10 15:36) [1]tfilestream.create("c:\blabla.bla", $FFFF);
← →
Pumpkin (2002-10-10 15:38) [2]ты не поверишь, но fmCreate
← →
Asderg (2002-10-10 15:41) [3]сорри за тупость.
в хелпе не описано...
← →
MBo (2002-10-10 15:42) [4]описано
← →
. (2002-10-10 15:43) [5]в хельпе все написанo
← →
. (2002-10-10 15:43) [6]эхо... =)
← →
Asderg (2002-10-10 15:46) [7]File open mode constants are used to control the access mode to a file or stream.
Unit
Sysutils
Category
file management routines
static const Shortint fmOpenRead = 0x0;
static const Shortint fmOpenWrite = 0x1;
static const Shortint fmOpenReadWrite = 0x2;
static const Shortint fmShareCompat = 0x0;
static const Shortint fmShareExclusive = 0x10;
static const Shortint fmShareDenyWrite = 0x20;
static const Shortint fmShareDenyRead = 0x30;
static const Shortint fmShareDenyNone = 0x40;
Description
The file open mode constants are used when a file or stream is opened to control how it can be shared.
The TFileStream constructor has a Mode parameter that you can set to one of these constants:
Constant Definition
fmOpenRead Open for read access only.
fmOpenWrite Open for write access only.
fmOpenReadWrite Open for read and write access.
fmShareCompat Compatible with the way FCBs are opened.
fmShareExclusive Read and write access is denied.
fmShareDenyWrite Write access is denied.
fmShareDenyRead Read access is denied.
fmShareDenyNone Allows full access for others.
может я тупой, но не слепой.. :(
← →
. (2002-10-10 15:48) [8]To create or open a file and get access to a handle for the file, you simply instantiate a TFileStream. This opens or creates a named file and provides methods to read from or write to it. If the file cannot be opened, TFileStream raises an exception.
constructor Create(const filename: string; Mode: Word);
The Mode parameter specifies how the file should be opened when creating the file stream. The Mode parameter consists of an open mode and a share mode or’ed together. The open mode must be one of the following values:
Table 1.11 Open modes
Value Meaning
fmCreate TFileStream a file with the given name. If a file with the given name exists, open the file in write mode.
fmOpenRead Open the file for reading only.
fmOpenWrite Open the file for writing only. Writing to the file completely replaces the current contents.
fmOpenReadWrite Open the file to modify the current contents rather than replace them.
The share mode can be one of the following values with the restrictions listed below:
Table 1.12 Share modes
Value Meaning
fmShareCompat Sharing is compatible with the way FCBs are opened.
fmShareExclusive Other applications can not open the file for any reason.
fmShareDenyWrite Other applications can open the file for reading but not for writing.
fmShareDenyRead Other applications can open the file for writing but not for reading.
fmShareDenyNone No attempt is made to prevent other applications from reading from or writing to the file.
Note that which share mode you can use depends on which open mode you used. The following table shows shared modes that are available for each open mode.
Open Mode fmShareCompat fmShareExclusive fmShareDenyWrite fmShareDenyRead fmShareDenyNone
fmOpenRead Can’t use Can’t use Available Can’t use Available
fmOpenWrite Available Available Can’t use Available Available
fmOpenReadWrite Available Available Available Available Available
The file open and share mode constants are defined in the SysUtils unit.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.10.21;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.008 c