infinite while loop


Recommended Posts

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)

            Private String DocContents = File.Read(OpenFile)         // Read the open file line by line
            StrIn = Parse(DocContents,-1,",")         // Parse the content by the commas


Link to comment
Share on other sites

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

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


This topic is now archived and is closed to further replies.