printout string variable using oflog

title says it, somehow i don’t get it working, do i have to do another conversion if i want to read out a string variable using oflog?

this should work, although it’s pretty difficult to tell you what went wrong when you don’t post the code you used. :stuck_out_tongue:

sry:)

i tried something like:

  
  
ofLog(OF_LOG_NOTICE, "text = " + stringvar);  
  
  

aaaand what happens? :stuck_out_tongue:

for me it works without problems.
in e.g. emptyExample:

  
void testApp::setup(){  
	string bla = "something";  
    ofLog(OF_LOG_NOTICE, "text = " + bla);    
}  

output:

  
[notice] text = something  

Hm, well then there is some with my string. I try to read out an xml attribute, which is pure text. I try to write that into an string variable, I ll post code later. Hope you can help me. Thanks

Maybe the problem is that you need to cast your datatype to a String… ??
eg:

  
int stringvar = 5;  
ofLog(OF_LOG_NOTICE, "text = " + ofToString(stringvar));   
  

Or is it already a string ?

No it’s already one. I have used the code you mentioned before and it works fine when converting ints etc. Must be a problem with reading out the xml fine, because when initialising a fresh string by hand it works as it should. thanks anyway. :slight_smile: