Ola pessoal estou tendo dificuldades com a leitura de um arquivo TXT, peguei um programa q ja faz isso porem por algum motivo na hora da leitura dos dados a funcao entra em loop infinito. Poderiam me ajudar com o problema ou postar algum codigo exemplo. segue a baixo o ponto q entra em loop infinito e o arquivo do codigo completo em ZIP
bool GetValuesParamsFromFile(int hdl,double &array[])
{
int
sgn=0, // Sign number "="
cnts=0; // String counterstring str=""; // String that is readulong tell_seek=0,tseek=0; // Position of the pointerstring delUser="------\nThe user has deleted the program from the chart!";
//---FileSeek(hdl,0,SEEK_SET); // Move the pointer to the beginning//---// Read until the file pointer reached the end of the filewhile(!FileIsEnding(hdl))
{
if(IsStopped()) // If the user has deleted the program
{
// Delete all objects created by the Expert Advisor
DeleteAllExpertObjects();
Print(delUser); return(false);
}
//---while(!FileIsLineEnding(hdl)) // Read until the end of the file
{
if(IsStopped()) // If the user has deleted the program
{
// Delete all objects created by the Expert Advisor
DeleteAllExpertObjects();
Print(delUser); return(false);
}
//---
str=FileReadString(hdl); // Read the string//---
sgn=StringFind(str,"=",0); // Get the separator number
str=StringSubstr(str,sgn+1); // Get everything that is after the separator
array[cnts]=SD(str); // Place the value in the array having converted it to the double type//---
tell_seek=FileTell(hdl); // Get the position of the pointer//---if(FileIsLineEnding(hdl)) // If it is the end of the string
{
// Go to the next string if it is not the end of the fileif(!FileIsEnding(hdl))
{ tseek=tell_seek+1; } // Increment the counter for the pointer//---// Move the pointerFileSeek(hdl,tseek,SEEK_SET); cnts++; break;
}
}
//---// If it is the end of the file, exit the loopif(FileIsEnding(hdl)) { break; }
}
//---// Return that reading has been completed successfullyreturn(true);
}
Ola pessoal estou tendo dificuldades com a leitura de um arquivo TXT, peguei um programa q ja faz isso porem por algum motivo na hora da leitura dos dados a funcao entra em loop infinito. Poderiam me ajudar com o problema ou postar algum codigo exemplo.
segue a baixo o ponto q entra em loop infinito e o arquivo do codigo completo em ZIP