Autor Beitrag
luckyluke84
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54

WinXP
Lazarus
BeitragVerfasst: So 01.08.04 22:26 
unit Dateizugriff;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
interface
type TDatei = File of String[10];

implementation

procedure
var s : string;
    my_file : TDatei;
begin
   assign(my_file,'c:  est.txt');
   rewrite(my_file);
   s := 'versuch';
   write(my_file, s);
   close(my_file);
end;


Wenn ich dieses Prog. ausführ und dannach die
Datei "test.txt" öffne dann steht da folgendes
drin : "versuch" Das ist unschön. Eigentlich
sollte da "versuch___" (3 Leerzeichen am Ende) drinstehen.
Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconPeter Lustig: Topic aus Dateizugriff verschoben am Sun 01.08.2004 um 23:31
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 01.08.04 22:28 
Prüf doch mit Length() die Länge des Strings und füge bei Bedarf Leerzeichen ein.

Alstar
MasterT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Win XP x64, Win 98, Win 2000, Win ME
D6 Prof., Delphi 2006
BeitragVerfasst: So 01.08.04 23:55 
Füg doch einfach hinter "versuch" 3 Leerzeichen ein. Leerzeichen ist glaube ich ASCII 32. Dann haste die auch in deiner Datei stehen.

Gruß

MasterT
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Mo 02.08.04 22:04 
ausblenden Delphi-Quelltext
1:
2:
3:
s:='versuch';
//Padding
s:=s+StringOfChar(#32,max(0,10-LENGTH(s)));

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca