DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

arrays

 
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
hidingmonkey
Member


Joined: 05 Nov 2003
Posts: 1

PostPosted: 05/11/03 13:51    Post subject: arrays Reply with quote

i want to read 1 2 3 4 or something of that format, four integers with a space inbetween from a text file. Once read i need to store each integer into an array so that it can be used later. How would i do this as i have tried many different ways and none seem to work. So for example
myArray[1]=1
myArray[2]=2
etc but it ignores the spaces
Back to top
View user's profile
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 255

PostPosted: 05/11/03 19:43    Post subject: Reply with quote

Code:
var
  YourArray: array[1..4] of Integer;
  I: Integer;
  F: TextFile;
begin
  AssignFile(F, 'YourFile.foo');
  Reset(F);
  for I := Low(YourArray) to High(YourArray) do
    Read(F, YourArray[I]);
  CloseFile(F);
end;
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group