Read from file error! New comment [Deleted] 2008.05.28 10:53 Hello! I would read two string from file,(file.txt),but don't work for me,I recieive two error message:Too many Opened Files,and File was not found! the file.txt in tester/Files folder. Here is the code: extern string FileName = "file.txt"; int init() { return(0); } int deinit() { return(0); } int start() { int handle; handle=FileOpen(FileName,FILE_CSV|FILE_READ,';'); if(handle<1) { Print("File was not found: ", GetLastError()); return(false); } int i= 0; while(!FileIsEnding(handle)) { string one=FileReadString(handle); string two=FileReadString(handle); FileReadString(handle); i++; } //---- //---- return(0); } //+------------------------------------------------------------------+ Thanks for help! Could someone tell me why This EA is not working. [Archive!] Writing an advisor for free Automatically setting InitialDeposit via Ini file or some other means Slava 2008.05.28 12:19 #1 Every time when the start function runs You open file but don't close it New comment
Hello!
I would read two string from file,(file.txt),but don't work for me,I recieive two error message:Too many Opened Files,and File was not found!
the file.txt in tester/Files folder.
Here is the code:
extern string FileName = "file.txt";int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int handle;
handle=FileOpen(FileName,FILE_CSV|FILE_READ,';');
if(handle<1)
{
Print("File was not found: ", GetLastError());
return(false);
}
int i= 0;
while(!FileIsEnding(handle))
{
string one=FileReadString(handle);
string two=FileReadString(handle);
FileReadString(handle);
i++;
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Thanks for help!