06-17-2004 11:33 PM
06-18-2004 04:10 AM
06-22-2004 09:50 AM
06-16-2007 01:19 PM
I had that problem too, the thing you have to understand before is that a LStrHandle DATA, is composed by two sectors, the characters chain, and the size of it.
For example:
#include "extcode.h"
#include "hosttype.h"
#include <string.h>
MgErr CINRun(int16 *Value, int16 *Numeric, LStrHandle labviewstring,
LVBoolean *findFIRSTerr, int16 *SizeFindFirst);
MgErr CINRun(int16 *Value, int16 *Numeric, LStrHandle labviewstring,
LVBoolean *findFIRSTerr, int16 *SizeFindFirst)
{
Char value[32]; // or char *value;
Short size;
Size=strlen(value);
memcpy(LStrBuf(*labviewstring),value,32)
or
memcpy(LStrBuf(*labviewstring),value,size)
or
strncpy(LStrBuf(*labviewstring),value,size)
and after that you should do this too.
LStrLen(*labviewstring)=size;
This works good, but lately in a random way I get the memory crash, what I think is happening is that I have to initialize the LStrHandle before using it because its pointer get sometimes a reserved sector of memory and it crash, my question is how to create and initialize a LStrHandle data, in C?![]()
Ing. Jorge M. Gamboa
Departamento de Mecatrónica
Tec de Monterrey
e-mail: ing.gamboa@gmail.com