cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Need help using ProGtolValueStringGet

MH_10366957
10-Marble

Need help using ProGtolValueStringGet

Hello,

 

I am currently trying to update an old Toolkit script from Creo 5 to 9, and a couple functions,(ProGtoldataFreeStateGet, ProGtoldataDiameterGet etc.) were updated to ProGtolValueStringGet. I was looking at this article Article - CS280972 - How to use ProGtolSymbolStringGet and ProGtolValueStringSet to replace deprecated Creo Toolkit API 4.0 and onward (ptc.com) for assistance, but I was unable to discern what the actual output of ProGtolValueStringGet would be. I tried printing it out to the console to figure it out, but I also could not figure out how to get the otk_install.exe from the otk_install.sln that I am running the scripts on, to print it out.

 

Any and all help would be greatly appreciated,

 

Thank you,

Mark Hardebeck

ACCEPTED SOLUTION

Accepted Solutions
FV
17-Peridot
17-Peridot
(To:MH_10366957)

ProGtoValueStringGet(...) for output argument  needs a pointer to a pointer to wchar_t.  Meaning: the return value would be allocated on-heap and needs to be freed at the end of the run. 

TestGtol.c from the example directory shows how to do it, here is a (modified to print to a console) code snippet from that file:

{
    wchar_t* valString = NULL;
    if( PRO_TK_NO_ERROR == ProGtolValueStringGet(gtol, &valString)) {
          wprintf (L"%ls\n", valString);
          ProWstringFree(valString);
    }
}

 

View solution in original post

3 REPLIES 3
FV
17-Peridot
17-Peridot
(To:MH_10366957)

ProGtoValueStringGet(...) for output argument  needs a pointer to a pointer to wchar_t.  Meaning: the return value would be allocated on-heap and needs to be freed at the end of the run. 

TestGtol.c from the example directory shows how to do it, here is a (modified to print to a console) code snippet from that file:

{
    wchar_t* valString = NULL;
    if( PRO_TK_NO_ERROR == ProGtolValueStringGet(gtol, &valString)) {
          wprintf (L"%ls\n", valString);
          ProWstringFree(valString);
    }
}

 

MH_10366957
10-Marble
(To:FV)

I tried that, but I was unable to get the output to go to the console, I do have the settings set so print functions will print to console, however I ended up putting it into a log file instead, thank you for the help.

FV
17-Peridot
17-Peridot
(To:FV)

you should try using 'make_simple_async' makefile as a learn-test 'template'

Announcements


Top Tags