本人是菜鳥,寫了個合并資料檔案的代碼,現在的問題是:合并后的資料檔案格式不是我想要的,合并后是分段顯示資料子檔案,我需要的是用空格分隔所有資料檔案,而不是分段顯示。請大俠幫幫我!謝謝了!下面是我的原代碼:
procedure TForm1.Button1Click(Sender: TObject);
varI: integer;
s,F: TextFile;
FirstLine,content: AnsiString;
begin
OpenDialog1.Options := [ofAllowMultiSelect, ofFileMustExist];
OpenDialog1.Filter := 'Text files (*.txt)|*.txt|All files (*.*)|*.*';
OpenDialog1.FilterIndex := 2; { start the dialog showing all files }
if OpenDialog1.Execute then
with OpenDialog1.Files dofor I := 0 to Count - 1 do
begin
AssignFile(F, Strings[I]);
Reset(F);
while not Eof(F) do
begin
Readln(F, FirstLine);
Memo1.Lines.Append(FirstLine);
end;
CloseFile(F);
end;
if savedialog1.Execute thenMemo1.Lines.SaveToFile (Savedialog1.Filename);
end;
uj5u.com熱心網友回復:
1、文本檔案原格式、需要格式均沒有說明;2、文本檔案可能通過寫入StringList,再寫入文本檔案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/87404.html
標籤:語言基礎/算法/系統設計
