removing of underscore in outfile

closed account (STR9GNh0)
infile consist of: things with underscore.
eg. C_plus_plus

code:
struct
{
char name [MAX];
}

afile << "Name: " << name;

i tried this:
if (name == '_')
afile << " " << name;

but is of no use


my outfile generates the same C_plus_plus.
is there a way to get rid of the underscore for my outfile?


thanks for all help. i am just a novice trying to learn c++
Last edited on
closed account (STR9GNh0)
seems like no 1 knows the answer
Do you want to convert "C_plus_plus" to "C plus plus" ?

for i from 0 to MAX or until name[i] == '\n'
   if name[i] == '_' then name[i] = ' '
closed account (STR9GNh0)
thanks for the reply but it keeps generating ISO C++ forbids comparison between pointer and integer. and that is what "traps" me

i have no issue doing for those with the int but not with char.
Post your code - much easier and less time wasting.

Topic archived. No new replies allowed.