Autor Beitrag
DennisSpohr
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 04.11.06 12:20 
Hi

wie und wo kann ich bei einem eingeschränkten Benutzerkonto eine Datei schreiben, ändern und löschen?

Danke Dennis


Moderiert von user profile iconChristian S.: Topic aus Sonstiges (Delphi) verschoben am Sa 04.11.2006 um 12:24
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 04.11.06 12:24 
Du kannst nicht ins Programmverzeichnis und auch nicht ins Systemverzeichnis schreibend zugreifen. Du kannst folgende Procedure benutzen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
//überprüft, ob in einem Verzeichnis Schreibrechte zur Verfügung stehen
function IsDirWritable(Dir: string): boolean;
var stream: TFileStream;
begin
  try
    stream := TFileStream.Create(Dir+'\dummy.dat',fmCreate);
    result := true;
    FreeAndNil(stream);
    DeleteFile(Dir+'\dummy.dat');
  except
    result := false;
    FreeAndNil(stream);
  end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.11.06 12:54 
Du kannst aber ins Benutzerverzeichnis schreiben (z.B. in Eigene Dateien oder C:\Dokumente und Einstellungen\Benutzername\Anwendungsdaten\). Wie du den Ordner herausfindest, steht hier:
www.delphipraxis.net...lders+ermitteln.html

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 04.11.06 13:58 
@Marco D: Ich will ja nicht wissen, wie du feststellst, ob eine Verkehrsampel rot ist. Einfach auf die Kreuzung fagren und wenn es kracht war es rot? :shock:

Hier der bessere Weg: www.michael-puff.de/...CheckFileAccess.html
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 04.11.06 14:11 
user profile iconLuckie hat folgendes geschrieben:
@Marco D: Ich will ja nicht wissen, wie du feststellst, ob eine Verkehrsampel rot ist. Einfach auf die Kreuzung fagren und wenn es kracht war es rot? :shock:

:mrgreen:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Sa 04.11.06 14:59 
user profile iconLuckie hat folgendes geschrieben:
@Marco D: Ich will ja nicht wissen, wie du feststellst, ob eine Verkehrsampel rot ist. Einfach auf die Kreuzung fagren und wenn es kracht war es rot? :shock:

Hier der bessere Weg: www.michael-puff.de/...CheckFileAccess.html


Solche Beiträge sind der Grund, warum ich dieses Forum liebe...

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell