LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Pb to write binary file

Hello,
I'm using a circular file (FIFO) where I store data continuously (3 times per second)
Around 4 or 5 hours after that I started my program
The function File = fopen (FichierHistoTest, "rb+"); returns the error "No such file or Directory ".

In fact all my write operations on my different files are blocked when this error occurs.
If I shut down the program than I restart it it's working well again, my pointers were not lost and my program continue to add new data after the last one before the error in each file.
I've never seen that before and this part of program is working well on several application on another computers.

File = fopen (FichierHistoTest, "rb+");
    if(File!=NULL){                                 
        fseek (File, (pointhistoTest*sizeof(HISTO)), SEEK_SET);
        fwrite (&histo, sizeof(histo), 1, File);
        fclose (File);
       
        if( giFlagFileReadPb){
                SetCtrlVal(handle, PANEL_LED_FILE,TRUE);  // Comment: This LED becomes red when the write operation fails
                giFlagFileReadPb=FALSE;
                   
        }   
       
        pointhistoTest++;
        if (pointhistoTest>=lMaxHisto)        pointhistoTest=0;

        File = fopen (FichierParaHistoTest, "w");
        fprintf (File, "%lu\n", pointhistoTest);
        fclose (File);
    }
    else {
        if( !giFlagFileReadPb){
                SetCtrlVal(handle, PANEL_LED_FILE,FALSE);
                giFlagFileReadPb=TRUE;
                   
        }           
        pointhistoTest=pointhistoTestMem;
    }   

The path of the file is a relative path, I mean that I use only the name of the file e:g: "EnregistrementsRealTime.bin" => FichierHistoTest    ;   "ParametresRealTime.txt" => FichierParaHistoTest

The computer a DELL Inspiron T3400 connected to Internet and to the LAN of the plant equipped wit Antivir.

Any Idea?
And how to reset my problem without reseting my program?

Thank You

D520
0 Kudos
Message 1 of 3
(3,183 Views)

The fact that all your program writes are blocked makes it sound like an operating system related condition. (5 hours * 3600 * ~3 per second is getting close to 65536 - suspicious? What is the OS?) At the point this error occurs, and before you abort your program, if you use Explorer to examine the drive/directory you are writing to, is there anything unexpected there? Like too many (temporary) files, no space left on the drive... I presume the program is in release mode, not debug?

JR

0 Kudos
Message 2 of 3
(3,181 Views)
Thank you for you quick answer.

I calculate that my system store 48837 data before the first problem
The second time (after restarting my program) the problem occurred after 53406 storages
The third time after 61314
So I think that your have a good idea to suspect an int size problem I will investigate in this way.
But My computer works with Windows XP Pro SP2 and my program (developed with LabWindows8.1) runs in release mode.

But We use the same machine with the same program in other plants and I never noticed this problem!
If you have any idea to force the program to reset this situation without shutdown it and restart it it will be great.

Thanks for your Help
D520

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