Using MS Visual C 6.0 and Labview 5.01f I'm trying to write a little C program for a CIN with a 1d-array in it.
I've had a look for examples but I either found none with 1d-arrays or the examples were not complete and wouldn't work or even compile. So I took a sample of code by (labview's?) A. Rafiq and tried to complete it (Source attached).
Code will compile, if I try to write into the array the vi will crash. If I don't I get an array of set length (i.e. 100) but trying to save my vi with the fresh loaded CIN will get me an "insane object" error 🙂
Where did I go wrong?
Please, if anyone should bother to answer: Could You provide me with both code examples for READING and WRITING into arrays within CINS?
The problem OF C OURSE not being a labview but rather a C-problem ... I know, I know ... (it's the handlers and the pointers that are scaring me ... off ).
You're better off using NumericArrayResize - let LabVIEW handle the details - it would have caught your mistake.
Your example sizes the array large enough for 100 integers (404 bytes) and sets the dimSize to 100. But the prototype says that LabVIEW is expecting float64s. You told it there were 100 in the array, but the memory (804 bytes) wasn't there.
Steve Bird Culverson Software - Elegant software that is a pleasure to use. Culverson.com