dle Posted November 16, 2016 Share Posted November 16, 2016 I'm just curious the code below doesn't cause any trouble Private String StrIn Private String OpenFile = File.Open(SetLocation,1,0,0,1) While(1) Private String DocContents = File.Read(OpenFile) // Read the open file line by line StrIn = Parse(DocContents,-1,",") // Parse the content by the commas Endwhile Link to comment Share on other sites More sharing options...
AzeoTech Posted November 17, 2016 Share Posted November 17, 2016 Why would it? Other than the fact you don't have an escape from the while()? Read() on a text file never errors. You have to look at the response (i.e. docContents) and see if its an empty string (i.e. == "") and then break out of the loop. Link to comment Share on other sites More sharing options...
dle Posted November 17, 2016 Author Share Posted November 17, 2016 That's why I'm wondering. Whenever I run the sequence, the sequence ended when it reaches to the end of file. My CPU run normal and I don't notice any busy or freeze from DF at all. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 18, 2016 Share Posted November 18, 2016 In today's multicore computers, an infinite loop without delay doesn't always mean a freeze or busy DF since only one core would get tied up. The exception is if the code was running in the primary DF thread, namely in a component Action or triggered from the command/alert. But, in your case, I'm actually surprised. Do you get an error message? I'm assuming you are running in a sequence. Does the sequence run and then stop? Link to comment Share on other sites More sharing options...
dle Posted November 18, 2016 Author Share Posted November 18, 2016 I have received no error message and the sequence also stopped. I could run it again. I tried different files at a time and the files were read correctly. I used Try and Catch but the sequence did not return any error. I mostly If (DocContents == "") to break out of the loop. Does this also break out of the loop if it reach a blank row? The file I'm reading has many blank rows in between data rows. Link to comment Share on other sites More sharing options...
dle Posted November 18, 2016 Author Share Posted November 18, 2016 Anyway, It could be any reason. What I've seen were unreliable. Same version of DF. It may behave differently. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.