我想在一个textfile里面读数据,textfile中的内容是这样的:
string1 string2
string1 string2
等等
其中string1 和string2 之间有两个空格,各个string1的长度不是一样的,string2后面还有一个回车符。我想从文件中读出这两个串,用readln/read怎么办?要是一个字符一个字符的读,最好给出程序!谢谢!
string1 string2
string1 string2
等等
其中string1 和string2 之间有两个空格,各个string1的长度不是一样的,string2后面还有一个回车符。我想从文件中读出这两个串,用readln/read怎么办?要是一个字符一个字符的读,最好给出程序!谢谢!
解决方案 »
- 有关查询中的时间问题
- ActionList的详细用法,能否说的详细一点。或者给段源代码!
- 还是关于combobox的问题。
- 谁用过SkinEngine 3.2.0这个控件?我有问题请教
- 怎样遍历DBGIRDEH中的数据?我是想检查其中的数据,不要有没填的。
- 我是VC程序员,现在想学Delphi,请推荐几本经典的好书!
- 菜鸟请教---急~~~~~~~
- ?报表里QRDBText面的Mask属性能否把时间(2002-2-3 8:03)格式化为8:03!!!
- ◆500分,求购16*16 16色,24*24 16色图标库两套?????◆
- 我今天很伤感啊
- SQL Explorer和 BDE Administrator 都是做什么用的?有什么区别?
- 不知那位大侠有reportmachine的最新版的源码,
var
Stringlist : TStrings ;
I : INteger ;
s ,s1,s2 : String ;
Index : INteger ;
begin
Stringlist := TStringlist.create ;
Stringlist.loadformfile('c:\temp.txt');
for I := 0 to Stringlist.count -1 do
begin
s := Stringlist[i] ;
Index := pos(' ',s);
if index >0 then
begin
s1 := copy(s,1,index);
delete(s,1,index);
s2 := trim(s);
//do other things
end ;
end ;
end;
var
f : TextFile;
string1 : string[10];
string2 : string[20];
begin
AssignFile(f,YouTxtFile);
Reset(f);
try
while not Eof(f) do
begin
Readln(f,string1,string2);
You Op
end;
finally
CloseFile(f);
end;
end; 你试试,不知可行否