LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

File handle number increment

Hello All

I have a CVI program that uses two ASCII Text files to hold progress info

as my program iterates. Each iteration, I want to overwrite each file with

new data.

My problem is that I have hundreds of iterations, and as the file handle numbers

increment I hit a value of 128 and my generates a file I/O error.

 

Seeing that I'm always writing to the exact same two files in the exact same

path, is there a way that I can hard code their file handle numbers to suppress

the handle number increment that occurs each time I call my write to file prototype?

0 Kudos
Message 1 of 3
(3,145 Views)

From what you say, it seems that your program works on 2 files only at each iteration; in the next iteration you do not need to access previous data. If this is true, you should not have progressive increment of the file handles and you should not have I/O errors provided you close the files when you have terminated using them.

I suggest you check in your code and add the necessary closing function.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,129 Views)

Hi Roberto

Yes, I did a dive into my code this weekend and found that if i just opened my files prior

to entering the structure, then closed them on exit, no problems. My mistake was assuming

that a file handle -once assigned and associated with a literal path to a file - would remain

static through each open/close. My bad.

 

Anyway, thank you for the response.

0 Kudos
Message 3 of 3
(3,123 Views)