01-20-2006 07:46 AM
02-03-2006 11:01 AM
02-05-2006 04:19 PM
In main(), did you intend to pass a pointer to the Data member of your struct?
Thus:
LogEnetData (fp, Message.MsgSize, Message.Data);
rather than:
LogEnetData (fp, Message.MsgSize, (unsigned char *)&Message.CsciSource);
Note that Message.Data is of type (unsigned char *) so the cast is unnecessary, and the address-of operator ( & ) will change the type of the passed parameter to (pointer to unsigned char *), which will not work.
02-06-2006 07:33 AM
There was no error in my original post, I wanted to bypass the first element since that was an internal house keeping variable that needed to be passed to LogEnetData ().
Hurst C.
02-06-2006 09:05 AM
02-06-2006 09:51 AM
I think the intent of the program is to effectively produce a dump of the entire structure (apart from the first, size word), not just the data field. So the pointer passed is indeed correct, as it points to the start of the area to be dumped. The problem was that CVI run-time protection did not realise that valid data extended beyond the first two bytes pointed to.
JR
02-06-2006 12:08 PM
Thanks, that is it exactly!
My issue is with CVI. I passed in an unsigned char pointer to be able to dump the whole message struct (minus the length field) to a log file, only to have CVI post a fatal run-time error in Debug mode after two bytes and then terminate. The program runs correctly in Release mode (no errors). There is a blatant inconsistency here!
Hurst C.
02-06-2006 03:33 PM
Hurst -
Can't you can dial back the level of runtime error checking to avoid the runtime array-bounds checking? As I recall there are three levels available (in the build panel I think) and you can run the debug executable, still catch library errors with a popup, but avoid popping up for an apparent array bounds violation.
I'm also wondering what would happen if you defined a pointer to the struct, then cast that pointer to a pointer to unsigned char. Maybe the CVI runtime error checking would then work.
Hayes
02-07-2006 08:46 AM
As forerror reporting, I have tried bracketing this section of code with DisableBreakOnLibraryErrors () and EnableBreakOnLibraryErrors () to no avail.
Hurst C.
02-07-2006 09:33 AM - edited 02-07-2006 09:33 AM
Message Edited by bilalD on 02-07-2006 09:39 AM