‎04-27-2009 09:50 AM
Hi,
I'm getting error code 11: too many files open when trying to write to a spreadsheet file. I'm running LabVIEW 8.6 on a cFP-2220. The vi calling the write to spreadsheet vi is running on the rt target. I've been running this vi for a couple weeks and have written164 files to the removable flash memory on the cFP controller without running into this issue. Is there a way to see what files are open and ensure that the files are closed properly?
‎04-27-2009 10:22 AM
Looks like WRITE TO SPREADSHEET FILE calls WRITE SPREADSHEET STRING, which unequivocally calls CLOSE FILE at the end, so I don't see an option for you to leave it open there.
Are you opening files from other places in your RT program?
Are you opening them via FTP from the host?
(I don't know cFP, but I know PXI).
Blog for (mostly LabVIEW) programmers: Tips And Tricks
‎04-27-2009 10:29 AM
‎04-27-2009 10:35 AM
I'm not sure, but it could be. If the message comes from the OS (and it probably does), then I would suspect that.
An open file is an open file. If you open it from the host, but don't close it, does that count as an open file on the host, or on the target, or both?
I'm not sure, but I would eliminate that possibility if I could.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
‎04-27-2009 10:36 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
‎04-27-2009 10:53 AM
‎04-27-2009 10:59 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
‎04-27-2009 11:18 AM
Ok,
I found a spot in the program where I was opening an FTP session and not closing it. Fixed that, didn't fix the problem. There isn't anywhere in the program where I'm actually opening the files over the ftp server. Basically, the program does this:
Logs on to ftp
Retrieves a list of all files in the d:/ directory on the cFP
User selects files from list to download
Downloads files selected using FTP Get Multiple Files.vi to designated folder on host machine
Closes ftp session
Opens downloaded files using local machine path (ie: c:/Documents and Settings...)
Manipulates data and closes the file
The last file successfully written to the cFP flash memory was the 164th file. Could I be hitting a limit for unique refnums within the RT OS? Is there a way to double check that?
‎04-27-2009 11:28 AM
Are you saying that you get this error EVERY TIME now that you've passed the 164th file?
Are the files in a single folder on the cFP?
Things to try:
delete two files from the CFP. If it write another one OK, then fails again, we have a hard limit somewhere. Maybe he error message is misleading in that the files aren't necessarily OPEN.
Try organizing the files into daily folders, so that you don't have 164 in one folder.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
‎04-27-2009 11:43 AM
Yep, that did the trick. I'll try the daily folder idea and see if that fixes things permanently.
Thanks for your help!