Printing Out Mouse Position

Hello All!
I’m trying to at the moment implement a 2D sidescroller shooter esk minigame
I have the mouse shown already, and i know that i can draw a line trace from the character to the mouse.
However i have been trying to just print out the value of the mouse via the screen to then take those values and plug into an aim offset later in the future.
At the moment i have tried

Just wondering how may i do this with some C++?

When i get the mouse position and the aim offset to work i plan to just shoot a raycast straight out of the gun. Since at that point it should be pointing in the correct position it should hit

You need to pass the X and Y as references (if you’re not sure what that means, read about it here) so the function can set them, like so:

float X;
float Y;

MyController->GetMousePosition(X, Y);

// Now your X and Y have their corresponding values

Edit:
I just noticed they have an example in the documentation:
https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/APlayerController/GetMousePosition/index.html

I Tried doing something like this yesterday, but something went wrong. However your solution worked so thanks!

U can use GetCursorPos(&).For initialisation struct use type - POINT. One trick - if u show off cursor, all will work, because cursor will binding camera vector. (GetCursorPos(&) - standart WinAPI function)

If u need get position from ActorComponent with standart UnrealAPI - use:

ACharacter* ownerCharacter = Cast<ACharacter>(GetOwner());
APlayerController* PlayerController = Cast<APlayerController>(ownerCharacter->GetController());
float X, Y;
PlayerController->GetMousePosition(X, Y);

If u need it from standart Character class, use this code (we talk about auto-generate Character class):

APlayerController* PlayerController = Cast<APlayerController>(GetController());
float X, Y;
PlayerController->GetMousePosition(X, Y);