I have the following functions which shifts the text by 4 and 8 characters. How can I pass an integer for the shift so that the text is shifted accordingly?
void prValue4_vd (
FILE* stream, // name of output stream
const char* value, // value associated with argument action key
const char* desc ) { // description
const char* frValue4_vd;
frValue4_vd = " \e[1;32m%s\e[0;37m %s\e[0m\n";
fprintf ( stream, frValue4_vd, value, desc );
}
void prValue8_vd (
FILE* stream, // name of output stream
const char* value, // value associated with argument action key
const char* desc ) { // description
const char* frValue8_vd;
frValue8_vd = " \e[1;32m%s\e[0;37m %s\e[0m\n";
fprintf ( stream, frValue8_vd, value, desc );
}
---------- Post updated at 06:33 PM ---------- Previous update was at 05:38 PM ----------
Done
void prDfltValue8_vd (
FILE* stream, // name of output stream
string value, // value associated with argument action key
string desc, // description
int shift ) { // shift
string shft(shift,' ');
string frValue8_vd = shft + "\e[42;1m \e[0m \e[1;32m%s\e[0;37m %s\e[0m\n";
const char* format = frValue8_vd.c_str();
const char* val = value.c_str();
const char* dsc = desc.c_str();
fprintf ( stream, format, val, dsc );
}