English 中文(简体)
Delphi - 寻求(); 程序。 不兼容的类型
原标题:Delphi - Seek(); Procedure. Incompatible Type
procedure ListMembers;
var
  Member, lMembers: string;
  lengthOfMember: Longint;
begin
  Writeln; 
  Writeln;
  Reset(FileA); //Only need read-only
  Reset(FileB); //Only need read-only
  while not Eof(FileA) do
    begin
      Readln(FileA, lMembers);
      Write(lMembers);
    end;
  Writeln(sLineBreak + sLineBreak);
  Write( Type the name of the member for more information:  );
  Readln(Member);
  lengthOfMember := Length(Member) + 2;
  Seek(FileB, lengthOfMember);
end;

我在试图编纂时就遇到问题。 寻求者;在最后一行中,错误类型是不一致的。 在我网上读到时,我总是想到:档案和var:我看不出为什么把它当作一种坏的样子,而我却把它当作一纸空子。

FileB was Assigned to a text file in the main section of the code. This part is just a procedure.

给予任何帮助。 下面更多的法典。

program WoWProject;

{$APPTYPE CONSOLE}

uses
SysUtils;

type
  TMember = record
  Name : string;
  Level : integer;
  CharClass : string;
  Role : string;
  Spec : string;
  DKP : integer;
end;

var
FileA, FileB : Textfile;

//THIS PART IS THE PROCEDURE ABOVE
//ANOTHER PROCEDURE HERE UNRELATED TO THIS
//ANOTHER HERE WHICH IS THE WELCOME PROCEDURE

//MAIN
begin
 Assign(FileA,  CharacterNames.txt );
 Assign(FileB,  CharacterInfo.txt );
 repeat
   Append(FileA);
   Append(FileB);
   Welcome;
 until 1=2
end.
最佳回答

文件介绍Seek(。 因此:

1. 将现有的一类或非类档案交给特定组成部分。 文本档案中没有使用。

问题在于你。

问题回答

您可使用这一程序:

PROCEDURE TextSeek(VAR F : TEXT ; POS : Cardinal);
  BEGIN
    WITH TTextRec(F) DO BEGIN
      BufPos:=0; BufEnd:=0;
      SetFilePointer(Handle,POS,NIL,FILE_BEGIN)
    END
  END;

但必须认识到,以上只是为了从档案中收回。 如果你在档案中投放,你就根本不喜欢档案中的 by子,而不管是否有任何线断(在现有的文本档案中,没有办法“插入”案文)。

Define RECORD type and open file as record or TFileStream. Write Your code again and then ask. You have many different code parts from... i dont know.

定义类似(实例):

type
 TMember = record
  Name : string[50];
  Level : integer;
  CharClass : string[50];
  Role : string[50];
  Spec : string[50];
  DKP : integer;
 end;
 Member = file of TMember;
var
  FileA : file of TMember;

在这种情况下,你必须长篇大举。 努力按照你的愿望开展工作;

You can change: from:

Seek(FileB, lengthOfMember); 

:

Seek(FileB, length(Member)); 




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签