PDA

View Full Version : TFileStream چیه؟



sasan_1364
شنبه 25 آذر 1385, 18:49 عصر
سلام به همه دوستان
میخوام بدونم که TFileStream چیه و در چه مواردی کاربرد داره و کارش چطوری ؟
با تشکرات فراوان:تشویق:

dkhatibi
شنبه 25 آذر 1385, 19:04 عصر
راهنمای دلفی اینچنین می گوید.


Use TFileStream to access the information in disk files.
TFileStream will open a named file and provide methods to
read from or write to it. If an application already has a handle to the file,
opened in the appropriate mode,
use THandleStream instead.


TFileStream را برای دسترسی به اطلاعات پرونده های دیسک به کار برید.TFileStream یک فایل نامبرده را برای نوشتن یا خواندن از آن باز می کند. اگر برنامه ی دیگری با فایل مذکور کار می کند برای باز کردن فایل به طور مناسب از THandleStream استفاده کنید.

و ببینید


Creates an instance of TFileStream.

C++ syntax:

__fastcall TFileStream(const AnsiString FileName, Word Mode);

Description

Call FileStream indirectly, using the new keyword, to instantiate a file stream for reading from or writing to the named file. Specify the name of the file and the way the file should be opened as parameters.

The Mode parameter indicates how the file is to be opened. 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:

Value Meaning

fmCreate Create 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 must be one of the following values:

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.

If the file can not be opened, TFileStream throws an exception.

soroush_vs
شنبه 25 آذر 1385, 19:06 عصر
یک کلاس برای کار با فایلها از انواع گوناگون و خواندن و نوشتن بر روی دیسک سخت.
این کلاس با یک رشته یا همون طور که از اسم کلاس پیداست با یک جویبار از صفر و یک ها ارتباط با دیسک را برقرار میکند