Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
programming:howtos-tips [2009/06/24 13:37]
cyril
programming:howtos-tips [2014/04/16 18:07] (current)
cyril [Conversions with string]
Line 117: Line 117:
  
 <code cpp> <code cpp>
-std::cout << "normal text, "  << "\033[1;28m"  +std::cout << "normal text, "  << "\033[1;33m"  
-          << "colored text, " << "\033[1;33m"+          << "colored text, " << "\033[1;00m"
           << "normal text" << std::endl;           << "normal text" << std::endl;
 </code> </code>
Line 182: Line 182:
 <code c> <code c>
   #define ERROR(msg, ...) fprintf("ERROR:%s:%d# ", __FILE__, __LINE__, ## __VA_ARGS__);   #define ERROR(msg, ...) fprintf("ERROR:%s:%d# ", __FILE__, __LINE__, ## __VA_ARGS__);
 +</code>
 +You can also use the ''PRETTY_FUNCTION'' but it is not standard:
 +<code>
 +  #define ERROR(msg, ...) fprintf("ERROR:%s:%d %s# ", __FILE__, __LINE__, __PRETTY_FUNCTION__, ## __VA_ARGS__);
 </code> </code>
  
Line 206: Line 210:
 #include <stdio.h> #include <stdio.h>
 char s[128]; char s[128];
-sprintf("%d", 565);+sprintf(s, "%d", 565);
 </code> </code>
  
Line 321: Line 325:
  public:  public:
   ...   ...
-  double() { return data / (double)(1<<8); }+  operator double() { return data / (double)(1<<8); }
 }; };
  
programming/howtos-tips.1245850641.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0