# Cannot use Hit.Item in my linetrace C++

**URL:** <https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155>\
**Category:** Cinematics & Media\
**Tags:** instance, index, unreal-engine, log, item, question\
**Created:** [February 11, 2019, 12:18pm UTC](https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155 "2019-02-11T12:18:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [February 11, 2019, 12:18pm UTC](https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155/1 "2019-02-11T12:18:23Z")

</div>

Hi,  
I’m relatively new to C++, and am currently loosing my mind trying to access the (int32)Item value from a FHitResult. I know my linetrace works ( `*Hit.GetActor()->GetName()` returns the correct object), but if I try logging `*Hit.Item`, I’m getting the following error pointing at the `UE_LOG` line: **“error C2100: illegal indirection”**.

```
  FHitResult Hit;
  if (GetWorld()->GetFirstPlayerController()->GetHitResultUnderCursor(ECollisionChannel::ECC_Camera, true, Hit))
    	{ 
    		UE_LOG(LogTemp, Log, TEXT("%s"), *Hit.Item);
    	}

```

---

<div class="post-metadata">

**Author:** ![SenseiHaketon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SenseiHaketon](https://forums.unrealengine.com/u/SenseiHaketon)\
**Post date:** [February 11, 2019, 12:59pm UTC](https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155/2 "2019-02-11T12:59:12Z")

</div>

That’s because Item is an int32. The %s refers to a String or a Char.

Replace “%s” with “%d” and remove the pointer from Hit.Item.

Like this:

```
 UE_LOG(LogTemp, Log, TEXT("%d"), Hit.Item);
```

---

<div class="post-metadata">

**Author:** ![Gamji](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamji](https://forums.unrealengine.com/u/Gamji)\
**Post date:** [February 11, 2019, 1:07pm UTC](https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155/3 "2019-02-11T13:07:10Z")

</div>

Ah … I feel dumb ahaha  
Thank you that was it!

---

<div class="post-metadata">

**Author:** ![SenseiHaketon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SenseiHaketon](https://forums.unrealengine.com/u/SenseiHaketon)\
**Post date:** [February 11, 2019, 1:20pm UTC](https://forums.unrealengine.com/t/cannot-use-hit-item-in-my-linetrace-c/443155/4 "2019-02-11T13:20:46Z")

</div>

No need to feel dumb. When I started, I struggled with this too 😉
