|
|
I am trying to write a macro that will read a file into an array. It
works when it is called the first time but when it is called a second
time I get this error.
#read (ReadFile <----ERROR
Parse Error: Expected 'file identifier', undeclared identifier
'ReadFile' found instead
What have I done wrong? I get no clues from the documentation and
looking at Tim Nikias Wenclawiak's io_macs.inc does not help me I am
obviously missing something. A sandwich short of a picnic maybe :
I hope it allowable to post the code here
Stephen
#macro ReadDat (File_Name, Buff_Name)
#fopen ReadFile File_Name read
#read (ReadFile,Var1,Var2,Var3)
#declare Buff_Name=array [Var1][Var2] ;
#local H1=0 ;
#while (H1< Var2 )
#local W1=0 ;
#while (W1< Var1)
#read (ReadFile,Var4)
#declare Buff_Name [W1][H1] = Var4 ;
#local W1=W1+1 ;
#end
#local H1=H1+1 ;
#end
#fclose ReadFile
#end
// First call of Macro
#declare File_Name = "b.dat" ;
#declare Buff_Name= "BufferLast" ;
ReadDat (File_Name, Buff_Name)
// Second call of Macro
#declare File_Name = "a.dat" ;
#declare Buff_Name= "BufferCur" ;
ReadDat (File_Name, Buff_Name)
Post a reply to this message
|
|