Why null char[] checking not working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-10
05:17 AM
- last edited on
‎2023-07-17
10:13 PM
by
Laszlo Nagy
I am try to put a condition checking for empty value of char[] as below code but still not working.
GS::Array<API_NavigatorItem> items;
API_NavigatorItem item = {};
char str[128];
memset(str, '\0', sizeof(str));
item.guid = guid;
item.mapId = mapId; //NavigatorPaletteTestGlobals::GetInstance().GetNavigatorMapID();
GSErrCode err = ACAPI_Navigator(APINavigator_GetNavigatorChildrenItemsID, &item, nullptr, &items);
if (err != NoError)
return;
for (API_NavigatorItem& childItem : items) {
if (GS::UniString(childItem.uiId).ToCStr().Get() != NULL) {
ACAPI_WriteReport("Value >>%s<>%s =>%i", true, GS::UniString(childItem.uiId).ToCStr().Get(), GS::UniString(str).ToCStr().Get(),childItem.isIndependent);
}
}
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-11 09:53 PM
OK now I think I've understood. And I've tested it a bit.
It seems that you can't delete items which are part of a cloned folder as you've found out.
The cloned folders have itemType = API_UndefinedNavItem.
So you could check if an items parent has this item type.
To get an items parent you can use APINavigator_GetNavigatorParentItemID.
Hope that helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-10 08:44 AM - edited ‎2023-07-10 08:44 AM
I think this condition
GS::UniString(childItem.uiId).ToCStr().Get() != NULL
will never be true, since you are creating an UniString object right there and this will have a pointer existing.
It's a bit unclear what exactly you want to achieve.
Maybe you need this?
!GS::UniString(childItem.uiId).IsEmpty()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-10 10:24 AM
Hello bschwb,
Actually I want to list the viewmap of navigator and check whether the item can be deleted or not as below picture but still can't find our the way.
Not sure you have any suggestion or not.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-11 01:31 PM
Which ones in the picture do you want to delete?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-11 04:24 PM
Hello bschwb,
From the given picture, if you select 'Floor Plans' then you can delete, but it's sub items such as story 1 you can't delete. I still can't find way to check whether the selected item can or can not delete from API function.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-11 09:53 PM
OK now I think I've understood. And I've tested it a bit.
It seems that you can't delete items which are part of a cloned folder as you've found out.
The cloned folders have itemType = API_UndefinedNavItem.
So you could check if an items parent has this item type.
To get an items parent you can use APINavigator_GetNavigatorParentItemID.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-07-12 04:49 AM