“You are writing mixed managed-unmanaged code without any need.
C++/CLR requires good knowledge of both native C++ and .NET. According to your needs, you may decide to go to pure native solution, with using MFC or WTL as UI Framework, or pure .NET solution using C#.
C++/CLI is used only in rare cases, for managed-unmanaged interoperability.
For your specific problem, tale a look at .NET String class and String.Format function, which replaces native sprintf.”
By Alex F Senior Member of CodeGuru