LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

File open in CVI

Solved!
Go to solution

Hello,

 

I have found out a little weird failure. Now I would like to now if this is normal.

In my application I would like to open simply a file to read.

 

    FILE     *fp=NULL; 
    fp = fopen (g_FileName, "r");
    if(fp == NULL)
        MessagePopup("Error","File can not be loaded.");

 

But now I found something out. When I delete my file out of directory and would like to opend the file, the error "File can not be loaded" should pop up. But my compiler stops by the fopen command and shows me the failure in the following. When I press then "countinue" I get the failure "File can not be loaded".

How can I stop this failure of the compiler is this normal?

 

Best regards

0 Kudos
Message 1 of 6
(4,016 Views)
Solution
Accepted by topic author Fasching_K

yes, this is 'normal', i.e., expected. You can bypass it in three ways:

- not use the debug version (actually it is the debugger reporting, not the compiler) but the release configuration

- uncheck Run / Break On / Library Errors,

- or add DisableBreakOnLibraryErrors() / EnableBreakOnLibraryErrors() before and after the failing command.

0 Kudos
Message 2 of 6
(4,007 Views)

Thank you.

 

Where can I set the first option in the program?

 

Kind regards

 

0 Kudos
Message 3 of 6
(4,003 Views)

Build / Configuration Smiley Happy

But it would not be my recommended way because you should be happy about the debugger assisting you during program development. Turning it off will also not show other warnings. I would just keep everything as it is - you have to click twice on a button during program development but now you know why, and that the debugger warning automatically will disappear once you build your release executable.

0 Kudos
Message 4 of 6
(4,001 Views)

You are right. I tried the .exe data and there is no failure.

Thanks a lot. 🙂

 

0 Kudos
Message 5 of 6
(3,998 Views)

You are welcome - I also learned a lot in this forum!

0 Kudos
Message 6 of 6
(3,995 Views)