Hi Guys or ladies can you help please
I’m trying to write an integer value to a TStringList with leading zero’s.
I’ve tried using setw() & setiosflags like I would normally if I write to a stream but I keep getting a message saying “Could not find a match for ios_manip” or something similar.
Can you help please, is there a way round it ?
/* ------ New Way ! ----- */
MyList = new TStringList();
MyList->Clear();
/* Note:
All I want it do is to input the 'Val_1' entered by the user with leading
zero's into MyList.
e.g.
000300
002800
000023
*/
/*Rem:: This code doen't work and displays the Message::
Can not convert wostream to AnsiString !. */
MyList->Append(inout << setw(Precision+1) << setiosflags(ios::right) << setfill('0') << Val_1);
/*Rem:: This code doen't work and displays the Message::
[C++ Error] TestProg.cpp(1253): E2094 'operator <<' not implemented in type '_Ios_Manip_1<int>' for arguments of type '_Ios_Setf_Manip'*/
MyList->Append( setw(Precision+1) << setiosflags(ios::right) << setfill('0') << Val_1);
Have a go with std::stringstream I haven't used for something like this, but I am guessing one can use the same formatting arguments that std::cout has, to make a string. Then it might work with your Append function, if it accepts std::string as an argument.
Some other things I am guessing about, I have no idea about how mad they be lol :