c++ - String Printer problems: no known conversion for argument X from ‘char (*)[xx]’ to ‘char**’ -


if there 1 thing hate c++ pointers. checked other thread , still not make work. code pretty simple, passing string of character in parameter, want pass in reference modify content of string. don't want use std classes. here code:

the function declared this:

public: static void bitfield_to_strfield ( s_enhancedsqlobject_strfield hash[], char **str, int bitfield ); 

i trying call function this:

enhancedsqlobject::bitfield_to_strfield ( strfld_elemental_property, &p_resistance_str, p_resistance ); 

the string declared as:

private: char p_resistance_str [ enhancedsqlobject_strfield_len ]; 

i following error

no known conversion argument 2 ‘char (*)[94]’ ‘char**’ 

according thread

c++ char*[] char** conversion

there seems sort of implicit conversion problem. tried creating temporary variable before passing in parameter , still not work.

char **tmptr = &p_resistance_str; 

gives me

cannot convert ‘char (*)[94]’ ‘char**’ in initialization 

the reason if return value string, return me null pointer unless dynamically allocate string, return string, destroy string.

else possible declare parameter as:

char *[] str 

since should using fixed width strings.

there no need pass address of string if want change elements in function. enough declare parameter like

char *str 

and use corresponding argument like

p_resistance_str 

as error string defined like

char p_resistance_str [ enhancedsqlobject_strfield_len ]; 

so pointer string have type

char ( * ) [ enhancedsqlobject_strfield_len ]; 

of course not same char **.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -