var
stream:tstream;
r:treader;if assigned(stream) then
  else
    stream:=tfilestream.Create('e:\test1.txt',fmopenread);  r:=treader.Create(stream,1024);
  showmessage(r.ReadString);//出错
应该用什么方法解决

解决方案 »

  1.   

    ReadString is a helper method used by other reader methods to read a string at the current reader Position. ReadString first checks the value type (TValueType) by calling the ReadValue method. If the item is a vaString or a vaLString type ReadString calls Read and returns the string. 
     *** Otherwise it raises an EReadError exception. // attetion here.Warning: Always use ReadString for reading component strings to streams. The similarly-named ReadStr method is for internal use only by certain CLX components.你读文件的话 不需要用Treader