Autor Beitrag
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 08.04.03 17:44 
Ich habe ein Problem mit folgendem Code:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var FileFromScript:PChar;
    buffer:tfilestream;
begin
  try
        SetFileAttributes (PCHAR (pathToINI) , FILE_ATTRIBUTE_NORMAL );
        buffer := tfilestream.create(pathToINI,fmcreate);
        try
           FileFromScript := Pchar ('http://localhost/index.htm');
           idhttp1.Get(FileFromScript,buffer);       
        except         
        end;
   finally
     buffer.free;
   end;
end;


der Fehler ist folgender:

machmal wird eine Exception ausgelöst, dass die Datei nicht erstellt werden kann. ich habe das mal in der einzelschrittfunktion aufgeführt. der fehler tritt immer in der zeile auf: buffer := tfilestream.create(pathToINI,fmcreate);
das problem ist, dass der fehler immer nur sporadisch auftritt. ich wiess nicht was der fehler ist.

Moderiert von user profile iconKlabautermann: Topic geändert.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 17:50 
vielleicht wird dein buffer nimma freigegben ab und zu ... also im code an sich kann ich keinen fehler sehen :?

du hast zwar buffer.free ... aber schau mal ob er das wirklich immer ausführt

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 08.04.03 18:07 
Vielleicht fehlt einfach nur das Share-Argument:  Buffer := tfilestream.create(fmCreate or fmShareDenyWrite);Dazu kommt, dass man die Create anweisung for den Try-Finally Block schreibt.

Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 09.04.03 13:34 
also ich werde mal das nit dem Share testen.

aber was meinst du damit, dass ich die create anwiesung for try schreiben soll ??

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Luncustaf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Mi 09.04.03 14:10 
na das du die variable buffer vor dem try createn sollst und nicht inner halb :D das mein er vllt damit :D


gr€€tz
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 11.04.03 13:49 
wieso soll man das denn vor dem TRY createn ??? dann hab ich ja gar keine fehlerbehandlung falls da was schief läuft !

_________________
In the beginning was the word.
And the word was content-type: text/plain.