x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to log a message from a string variable ?

Hello ,

I am trying to log a message form a string variable , below is the code I used

 std::string s = "ss";//std::to_string(FPaths::GetPath("../"));
 UE_LOG(LogTemp, Warning, *s);

but it's not working, Can someone tell me how to do this ?

![alt text][1]

Product Version: UE 4.12
Tags:
capture.png (37.6 kB)
capture.png (37.6 kB)
more ▼

asked Jul 21 '16 at 09:10 AM in C++ Programming

avatar image

Senific
8 3 4 8

avatar image NymKappa Jul 21 '16 at 09:16 AM

What "it's not working" means ? No log ? Crash ? Error ? Be explicit or people won't be able to help you out :-)

avatar image Senific Jul 21 '16 at 09:19 AM

It does not compile

avatar image Cloudy McStrife Jul 21 '16 at 09:25 AM

It doesn't compile because you need to use the TEXT Macro before giving a string into UE_LOG.

 FString s = "ss";
 UE_LOG(LogTemp, Warning, TEXT("%s"), *s);
 
 //or
 
 UE_LOG(LogTemp, Warning, TEXT("ss"));

 //this should work for you
 UE_LOG(LogTemp, Warning, TEXT("%s"), *FPaths::GetPath("../"));
 

Try to work with Unreal's version of Datatypes instead of using the std library

Greetings Cloudy

avatar image Senific Jul 21 '16 at 09:27 AM

Thanks friend :P

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question