<[EMAIL PROTECTED]> wrote: >Hi, when using the Ni library call I16 Get_Cal_date(I16 device, Char* >CalDate) we have a problem. If we connect a string constant to the Char* >input of the lib call, we get the proper data out of the string out of the >library call, yet Labview then crashes. If we leave char* unwired, labview >does not crash, but we get an I32 on the string out - is that the addy of >the string? If so, how can we get the string data. Or, are we doing this >wrong?
A C function is normally not supposed to allocate a buffer itself. That would give a lot of troubles as the caller would need to know how to free that buffer exactly to avoid crashes and memory leaks. The function however expects a buffer allocated by the caller of at least a certain size to fill in the information it wants. So wiring just an empty string constant will pass a 0 lenght buffer to the function and when it then tries to fill in the information you get a General Protection error. You need to create a buffer long enough for the function. The function documentation should contain the information about what size this has to be. Just create an U8 byte array with the needed size and convert it to a string. Rolf Kalbermatter CIT Engineering Nederland BV tel: +31 (070) 415 9190 Treubstraat 7H fax: +31 (070) 415 9191 2288 EG Rijswijk http://www.citengineering.com Netherlands mailto:[EMAIL PROTECTED]
