Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Dodavanje teksta u file...kako?

[es] :: Pascal / Delphi / Kylix :: Dodavanje teksta u file...kako?

[ Pregleda: 5012 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Divjak
Vladimir Divjak
Student

Član broj: 4783
Poruke: 535
*.zre.sezampro.yu



+1 Profil

icon Dodavanje teksta u file...kako?08.08.2003. u 03:20 - pre 250 meseci
Kako da dodam neki string u file?
Opcija tipa otvaranje fajla, dodavanje stringa u Delphiju pa snimanje u file mi ne odgovara jer previse spora...

Unapred hvala!
And don't be mad at me for crying for humanity,
call it pretensions but I got good intentions,
to keep my sanity, I'm hoping, fuck, there's gotta be
an answer to their strategies and their evil inventions... ~Looptroop
 
Odgovor na temu

Nub.Saibot
Srbija/BG

Član broj: 11838
Poruke: 99
*.direcpceu.com



Profil

icon Re: Dodavanje teksta u file...kako?08.08.2003. u 08:43 - pre 250 meseci
Pošto nisi dao više detalja, ostaje mi da predložim sledeće,
puni string listu pa na kraju pozovi njenu metodu SaveToFile.


Pozdrav
 
Odgovor na temu

-zombie-
Tomica Jovanovic
freelance programmer
ni.ac.yu

Član broj: 4128
Poruke: 3448
*.verat.net

Sajt: localhost


+5 Profil

icon Re: Dodavanje teksta u file...kako?08.08.2003. u 13:16 - pre 250 meseci
probaj Append() proceduru:

Citat:
Append();
Prepares an existing file for adding text to the end.

Unit: System
Category: IO routines
Delphi syntax:

procedure Append(var F: Text);

Description:

Call Append to ensure that a file is opened with write-only access with the file pointer positioned at the end of the file. F is a text file variable and must be associated with an external file using AssignFile. If no external file of the given name exists, an error occurs. If F is already open, it is closed, then reopened. The current file position is set to the end of the file.

If a Ctrl+Z (ASCII 26) is present in the last 128-byte block of the file, the current file position is set so that the next character added to the file overwrites the first Ctrl+Z in the block. In this way, text can be appended to a file that terminates with a Ctrl+Z.

If F was not assigned a name, then, after the call to Append, F refers to the standard output file.


Code:

var
  f: TextFile;
begin
  if OpenDialog1.Execute then
  begin                    { open a text file }
    AssignFile(f, OpenDialog1.FileName);
    Append(f);
    Writeln(f, 'I am appending some stuff to the end of the file.'); 
    { insert code here that would require a Flush before closing the file }
    Flush(f);  { ensures that the text was actually written to file }
    CloseFile(f);
  end;
end;


 
Odgovor na temu

Koljenovic
Koljenovic

Član broj: 9334
Poruke: 130



Profil

icon Re: Dodavanje teksta u file...kako?10.08.2003. u 01:01 - pre 250 meseci
Pa ja nisam ni sanjao da je "Delphi" kod ovoliko slican "Pascal" kodu...
Njutn laze! Lake padaju brze...
 
Odgovor na temu

goblin
Milan Aleksic
Gtech Belgrade, Sofware Engineer II
Beograd

Član broj: 4055
Poruke: 85
*.beotel.net

Jabber: milanaleksic@gmail.com
Sajt: www.milanaleksic.net


Profil

icon Re: Dodavanje teksta u file...kako?31.08.2003. u 20:54 - pre 250 meseci
Ja bih preporučio TFileStream i dodavanje bafera bajtova koji se dobijaju konverzijom nekog stringa. Koristite objekte u Delphi-ju... probajte da ostavite Turbo Pascal code za vama... mada je ovde očito da je malopre izložen code verovatno najlakši način da se reši problem naviknite se što pre na tokove (TStream i njegove potomke... MNOGO su značajni u Delphi-ju).

Pozdrav
Don't try to impress me... I'm good !
 
Odgovor na temu

Rapaic Rajko
Bgd

Član broj: 4105
Poruke: 810
*.pexim.co.yu



+62 Profil

icon Re: Dodavanje teksta u file...kako?01.09.2003. u 15:35 - pre 250 meseci
Citat:
Koljenovic:
Pa ja nisam ni sanjao da je "Delphi" kod ovoliko slican "Pascal" kodu...


Heh...za informaciju svima ovde: verzija kompajlera Delphi 6-ice je 13.0 ili 14.0 (kako gde). Pogodite sta su bile verzije 1.0, 2.0, 3.0...?
Pa TurboPascal, razume se.

Rajko

P.S. Legenda zivi i dalje...
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: Dodavanje teksta u file...kako?

[ Pregleda: 5012 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.