开发者

how to load textfile of /stext out put to memo1

开发者 https://www.devze.com 2023-01-10 06:18 出处:网络
i am trying load file after it created from /stext command line but its not loading up my code ShellExecute(0, nil, PChar(path+\'test.exe\'), PChar(\'/stext \"\' + path + \'save.txt\"\'), nil, SW_

i am trying load file after it created from /stext command line but its not loading up

my code

ShellExecute(0, nil, PChar(path+'test.exe'), PChar('/stext "' + path + 'save.txt"'), nil, SW_HIDE);

after it created file i tried to load to memo1 from another button click

like

procedure TForm1.Button2Click(Sender: TObject);
begin
Memo1.Lines.LoadFromFile(path+'save.txt');
end;

but its loading some unknown 3 charact开发者_如何学编程ers

ÿþ=

P.S : I opened manually it has real data of 30 lines :)

why its happening ?

and one more thing is after i executed my first command shellexecute how i know that the file creation is done to load to my memo in same function without using sleep function :S

thanks in advance

regards


Try and see if this works

procedure TForm1.Button2Click(Sender: TObject);
begin
  Memo1.Lines.LoadFromFile(path+'save.txt', TEncoding.UTF8);
end;

because the first characters you posted I think are from the UTF8 encoding.

Also, to double check if it's the encoding. Try opening that file in notepad, and see if it's alright.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号