LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

error

ok  my program dont wont to end , after the comport is not open, it continues and keep running the for completely

 the program suppose to shut down after the first error

 

can some one assist me?

0 Kudos
Message 1 of 4
(3,101 Views)

yes, that's true it does not end, i can see it only by reading the code.

and no, it is not supposed to end after the first error...

 

you wrote:

         [...]

     status_check = OpenComConfig (physical_port, "COM10", baudrate,             
                                   parity, databits, stopbits, inputq, outputq);
     switch_errors();
     
     for(counter=0;counter<3;counter++)

     {               

         [...]

 

please, place a breakpoint into your switch_errors() function, then use the "step" function until the end of the software to see what is happening.

 

it seems you misunderstood the meaning of the return keyword (once again, i will point you toward a good programming course...). the return keyword makes the program exit the current function, in your case it exits switch_errors(), but the program continues to execute where the function was called, in your case it executes the for loop just after the switch_errors() call.

 

(by the way, the return keyword has the same meaning in C++... if you see what i mean...)

0 Kudos
Message 2 of 4
(3,092 Views)

now that i think about it, exit(0); will work.  it works.

 

i always new that return 0; mean the program ended successfully

0 Kudos
Message 3 of 4
(3,083 Views)
This discussion started in another thread: I think it is better to maintain only one discussion open on this subject.
Message Edited by Roberto Bozzolo on 10-04-2009 11:11 PM


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?
0 Kudos
Message 4 of 4
(3,075 Views)