c++ - How do I check if a const char*'s value is defined? -


my application reads settings conf file first, , options can overwritten cli arguments. after loads settings conf, need check if require values set i'm stuck @ making check variables.

sample code:

#include <stdio.h>  int main() {  const char* test;  if (test != null)    std::cout << test << "\n"; else    std::cout << "no value set\n";  return 0; } 

what did wrong?

you didn't initialize test. if want null initially, have set it:

const char* test = null; 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -