AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Überprüfen ob Datei verfügbar

Ein Thema von Zyro · begonnen am 19. Nov 2003 · letzter Beitrag vom 19. Nov 2003
Antwort Antwort
Seite 2 von 2     12   
Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#11

Re: Überprüfen ob Datei verfügbar

  Alt 19. Nov 2003, 09:07
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.
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat
Zyro

Registriert seit: 4. Nov 2003
40 Beiträge
 
#12

Re: Überprüfen ob Datei verfügbar

  Alt 19. Nov 2003, 09:16
Ich stell mich sicher zu blöd an. Denn es will net. Der Compiler meckert:

[Error] Unit1.pas(299): ')' expected but ',' found
  Mit Zitat antworten Zitat
Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#13

Re: Überprüfen ob Datei verfügbar

  Alt 19. Nov 2003, 09:18
da hast du wohl irgendwas vergessen. sollte ungefähr so aussehen
Delphi-Quellcode:
var mystream: TStream; //oder TFileStream
begin
  try
    mystream := TFilestream.create('c:\meinedatei.txt', fmOpenReadWrite or fmShareExclusive);
    //lesen schreiben etc
  finally
    mystream.free;
  end;
end;
Edit: hatte vergessen "delphicode-tag" zu schließen
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat
Zyro

Registriert seit: 4. Nov 2003
40 Beiträge
 
#14

Re: Überprüfen ob Datei verfügbar

  Alt 19. Nov 2003, 10:08
Jo danke...es klappt
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:19 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz