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

API_Favorite_Get() fails

dushyant
Booster
Hello,

I am trying to load a favourite by API_Favorite_Get() using an API_Favorite made with favorite’s name as string. It fails. Whereas if I pass the name out of the array names[0], it works. Why is this happening? Code snippet pasted below.

Thanks, Dushyant.

   GSErrCode                    err = NoError;
   GS::UniString                favName;
   short                        count = 0;
   GS::Array<GS::UniString>     names;

   err = ACAPI_Favorite_GetNum (API_ColumnID,
                                APIVarId_Generic,
                                &count,
                                nullptr,
                                &names);

   favName = "Column - Rectangular”;
   //favName = names[0]; // this actually is ‘Column - Rectangular'

   API_Favorite    favorite (favName);
   ACAPI_WriteReport("API_Favorite - name: %s", false, favorite.name.ToCStr().Get());
   favorite.memo.New ();

   err = ACAPI_Favorite_Get (&favorite);
   if (err != NoError) {
       ACAPI_WriteReport ("ACAPI_Favorite_Get failed (Name: %s)", false, favName.ToCStr().Get());
       ACAPI_WriteReport ("err: %d", false, err);
       ACAPI_DisposeElemMemoHdls (&favorite.memo.Get ());
       return;
   }
1 REPLY 1

dushyant
Booster
The error was:
Name of the column had a space at the end, so it should be: "Column - Rectangular ", for reference of others.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!