consoleHelper.write_status("Error: " + (char*)gai_strerror(err_code));
delete
char* cast_ch = (char*)gai_strerror(err_code); consoleHelper.write_status("Error: " + cast_ch); delete cast_ch;
const char*
new
malloc
char*
#include <stdlib.h> #include <stdio.h> static char * p = (char *)0; void init_library(); const char * get_const_string(); void terminate_library(); void init_library() { if ( ! p ) { p = (char * ) malloc(6); p[0]='h'; p[1]='e'; p[2] = 'l'; p[3] = 'l'; p[4] = 'o'; p[5] = '\0'; } } void terminate_library() { if ( p ) free (p); } const char * get_const_string() { return p; }
const char *s = get_const_string(); s[0] = 'B'; // and ... const char *s = get_const_string(); free (s);
const
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)