Using LStrPrintf to print only limited subset

Hello,
I am a bit strugling using LStrPrintf inside DLL.
I am passing a 2D string array, everything works OK, but when I try to access individual elements using LStrPrintf to copy the data from array string handles, I allways copy some garbage, because the handle has no null termination for its data. I tried to limit the copied data using standard printf arguments, but it has some limited functionality.
typedef struct {
int32_t dimSize1;
int32_t dimSize2;
LStrHandle Strings[1];
} LVStringArray2D, **LVStrArrayHdl2D;
//THIS WORKS and returns 0
int StrArrAllocPokus2D(LVStrArrayHdl2D StrArr, LStrHandle LVStringH, int32_t element)
return(int)LStrPrintf(LVStringH, (CStr)"%.1s", (*(*StrArr)->Strings[element])->str);
//THIS crashes on LStrPrintf (no return)
int StrArrAllocPokus2D(LVStrArrayHdl2D StrArr, LStrHandle LVStringH, int32_t element)
return(int)LStrPrintf(LVStringH, (CStr)"%.*s", 1, (*(*StrArr)->Strings[element])->str);

Hello,
I want to be clear about your problem: with the function written below "//THIS WORKS", you get no error and you succesfully copy one character from StrArr 2D string array to LVStringH,right? And when you use this: 
int StrArrAllocPokus2D(LVStrArrayHdl2D StrArr, LStrHandle LVStringH, int32_t element)
return(int)LStrPrintf(LVStringH, (CStr) (*(*StrArr)->Strings[element])->str);
you read nonvalid data? What is configuration of parameters in Call Library Function Node for these functions?
Some usefull links to this: http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcode/printf/
and the overview of strings formats in attachment. 
Best regards,
Pavel J.
Attachments:
strings_format.png ‏36 KB

Similar Messages

Maybe you are looking for

  • Two groups with the same name in File and LDAP realms

    Hi, I configured WLS 6.0 SP1 to use an LDAP caching realm as default one. In the LDAP server (Netscape Directory) I have a group called Administrators. There is a group with the same name in WLS own File Realm. When I click on the Groups menu item in

  • SQL Features for FIM Synchronization Server

    Hi, As we need to Install the FIM Synchronization server  of FIM 2010 R2 SP-1 only. Could you please suggest if all the below sql server features are mandatory to install for FIM synchronization Server.  Database Engine Services Full-Text Search Anal

  • AVI files unplayable on iPhoto 9.0

    Most of my AVI files which use to play fine on iphoto have been converted to 0.01 second files showing up on iPhoto!  These files are all prior to 2010 (2002 to 2009) and show under iPhoto Library/originals/2009.  Under Originals I have three folders

  • TS3376 how do i take my phone off lock mode from the lost and track

    how do i take my phone off lock mode from the lost and track

  • Vertical dzen statusbar? [SOLVED]

    this started out as a let's-see-if-it's-possible sort of thing, and now it's driving me mad that I can't figure this out. I'm attempting to make dzen + conky act as a statusbar, positioned vertically on the left side of my screen. my current .xinitrc