XcanadamanX
03-23-2007, 01:24 AM
does anyone elses SaveToChatLog overwrite the previous chat log?
i tried this but it doesnt work gives me a file error.half taken from SaveToChatLog and half from ejj's account creator then smunched together.
also i see in SaveToChatLog; it uses TheFile as a file but when i try to use that in this one it gives me type mismatches.
Procedure SaveChat;
var
WritingFile, WritingFile2, size : Integer;
Info : String;
begin
WritingFile2:=OpenFile('ChatLog.txt', False);
size:=FileSize(WritingFile2);
ReadFileString(WritingFile2, Info, size)
CloseFile(WritingFile2);
WritingFile := RewriteFile('ChatLog.txt', False)
WriteFileString(WritingFile, +Info);
FixChat;
OldLine := TheLine;
if (GetLastChatText(TheLine)) then
begin
if OldLine <> theLine then
begin
LastChatter(TheName)
WriteFileString(TheFile, TheTime + ' ' + thename + ': ' + theline + Chr(13) + Chr(13));
end
end else
begin
LastChatter(theline)
if OldLine <> theLine then
begin
WriteFileString(thefile, TheTime + ' ' + theline + Chr(13));
// writeln(thetime+' '+theline);
end
end
CloseFile(WritingFile);
end;
i tried this but it doesnt work gives me a file error.half taken from SaveToChatLog and half from ejj's account creator then smunched together.
also i see in SaveToChatLog; it uses TheFile as a file but when i try to use that in this one it gives me type mismatches.
Procedure SaveChat;
var
WritingFile, WritingFile2, size : Integer;
Info : String;
begin
WritingFile2:=OpenFile('ChatLog.txt', False);
size:=FileSize(WritingFile2);
ReadFileString(WritingFile2, Info, size)
CloseFile(WritingFile2);
WritingFile := RewriteFile('ChatLog.txt', False)
WriteFileString(WritingFile, +Info);
FixChat;
OldLine := TheLine;
if (GetLastChatText(TheLine)) then
begin
if OldLine <> theLine then
begin
LastChatter(TheName)
WriteFileString(TheFile, TheTime + ' ' + thename + ': ' + theline + Chr(13) + Chr(13));
end
end else
begin
LastChatter(theline)
if OldLine <> theLine then
begin
WriteFileString(thefile, TheTime + ' ' + theline + Chr(13));
// writeln(thetime+' '+theline);
end
end
CloseFile(WritingFile);
end;