Autor Beitrag
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 24.01.07 19:31 
Wenn im Programmverzeichnis die datei test.dat besteht,
soll die eine box mit dem text ok auftauchen und wenn nicht,
dann eine box mit nicht ok.
Bitte um quelltext, schnell!


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 24.01.2007 um 19:33
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 24.01.07 19:35 
user profile iconstigge hat folgendes geschrieben:
Bitte um quelltext, schnell!
Sag mal, geht's noch? :? Sind wir hier Deine Lakaien? Zeig mal, was Du bisher versucht hast und was nicht geht. Helfen tun wir gerne, aber Deine Arbeit machen wir nicht.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Mi 24.01.07 19:37 
Die Funktion FileExists() sollte dir weiterhelfen.
Für die Box kannst du ShowMessage() Bzw Application.MessageBox() nutzen.

_________________
I believe that every human has a finite number of heart-beats. I don't intend to waste any of mine running around doing exercises.
- Neil Armstrong
perry5
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102



BeitragVerfasst: Mi 24.01.07 19:43 
user profile iconstigge hat folgendes geschrieben:

Bitte um quelltext, schnell!

Schon doof, wenn man Hausaufgaben erst abends anfängt, ne?

Also, alternativ kann man ja auch versuchen die Datei mit z.B. TFileStream oder sonst etwas zu öffnen. Theoretisch könnte es da zwar passieren, das die Datei zwar existiert, aber nicht geöffnet werdne kann, aber das sollte die Ausnahme sein 8was will man mit ner Datei, die man net öffnen kann?)
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.01.07 19:49 
kannst mal mit IO-Error probieren. mehr dazu in der onlinehilfe. die ausgabe des textes kannst mit canvas.textout.... vornehmen.

ach vergessen, willst ja eine box aufmachen... geht bspw. mit shellexecute...
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 24.01.07 20:53 
Eigentlich will ich nur wissen, wie man die Existenz einer Datei prüfen kann.
Und schnell habe ich nur geschrieben, weil ich noch heute Abend weitermachen will.
Sorry für die Ausdrucksweise
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: Mi 24.01.07 21:01 
user profile iconstigge hat folgendes geschrieben:
Eigentlich will ich nur wissen, wie man die Existenz einer Datei prüfen kann.
Und schnell habe ich nur geschrieben, weil ich noch heute Abend weitermachen will.
Sorry für die Ausdrucksweise

Ich gebe dir mal ein Stichwort: user profile iconDarkHunter :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
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.01.07 21:04 
wie gesagt, es gibt mehrere möglichkeiten, findfiles, fileexists, io-error abprüfen, on except... etc. etc. kannst dir was aussuchen...
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: Mi 24.01.07 21:06 
user profile iconGrenzgaenger hat folgendes geschrieben:
wie gesagt, es gibt mehrere möglichkeiten, findfiles, fileexists, io-error abprüfen, on except... etc. etc. kannst dir was aussuchen...

Wobei FileExists sicher das Beste ist. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.01.07 21:13 
möchte ich so nicht sagen. kommt auf den anwendungsfall an.. aber es stimmt, es ist EINE möglichkeit.
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: Mi 24.01.07 21:15 
user profile iconGrenzgaenger hat folgendes geschrieben:
kommt auf den anwendungsfall an..

Was ist denn z.B. an try-except in Verbindung mit einem FileStream besser als FileExists? :roll:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 24.01.07 21:18 
dachte hier z.b. an einen RESET . aber wie gesagt, das kommt drauf an...und es gibt für alle möglichkeiten beispiele wo es sinnmacht und beispiele wo es keinen sinnmacht...aber dies ist ein anderes thema
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: Mi 24.01.07 21:20 
user profile iconGrenzgaenger hat folgendes geschrieben:
dachte hier z.b. an einen RESET . aber wie gesagt, das kommt drauf an...und es gibt für alle möglichkeiten beispiele wo es sinnmacht und beispiele wo es keinen sinnmacht...aber dies ist ein anderes thema

Okay, belassen wir es dabei. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Mi 24.01.07 21:21 
Ok, funktioniert mit FileExist.
Danke für die schnelle Hilfe^^.