Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

INF: Has anyone made a CString, sprintf, and sscanf for .NET?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ATS - 11 Jul 2005 22:00 GMT
INF: Has anyone made a CString, sprintf, and sscanf for .NET?

Please help,

I want to code with PURE .NET (i.e. pure CLR). No MFC, No ATL, no C-Run Time
Library. But I want CString, sprintf, and sscanf.  The "String" class in .NET
is completely worthless to me, especially its so called "Format" method. In
fact to just, harp on how "lacking" it is to me, in C++.NET, one can NOT do
this:

       String *csTest;
       csTest = "Hello";
       csTest += "!!!"; // ==> This generates an error...

This generates these compile errors:

error C2297: '+=' : illegal, right operand has type 'const char [4]'
cannot perform pointer arithmetic on __gc pointer 'System::String __gc *'

With that said, PLEASE DO NOT RESPOND TO THIS ISSUE IN REGARDS TO DOING
ANYTHING WITH .NET "String". ACCEPT IT. IT LEAVES A LOT FOR ME TO DESIRE.

So. Before I go down the road to making my own CString class for C++.NET,
has anyone by chance made one already? How about the sprintf and sscanf
functions?
Carl Daniel [VC++ MVP] - 11 Jul 2005 22:24 GMT
> INF: Has anyone made a CString, sprintf, and sscanf for .NET?
>
[quoted text clipped - 15 lines]
> cannot perform pointer arithmetic on __gc pointer 'System::String
> __gc *'

That's a limitation of managed extensions for C++, not a limitation of the
.NET System::String class.  MC++ cannot do operator overload resolution for
.NET types because you're dealing with pointers and not objects.  The .NET
string class in fact does support what you want, it's just hard to get at
from C++ (but easy and obvious from C#).

> With that said, PLEASE DO NOT RESPOND TO THIS ISSUE IN REGARDS TO
> DOING ANYTHING WITH .NET "String". ACCEPT IT. IT LEAVES A LOT FOR ME
[quoted text clipped - 3 lines]
> C++.NET, has anyone by chance made one already? How about the sprintf
> and sscanf functions?

Go for it.  IMO the .NET string/formatting classes already provide far more
capability that CString/sprintf/sscanf, but YMMV.

-cd
Nishant Sivakumar - 12 Jul 2005 05:00 GMT
Have you seen this article?
http://www.codeproject.com/csharp/CsScanf.asp

Signature

Regards,
Nish [VC++ MVP]
http://www.voidnish.com
http://blog.voidnish.com

> INF: Has anyone made a CString, sprintf, and sscanf for .NET?
>
[quoted text clipped - 25 lines]
> has anyone by chance made one already? How about the sprintf and sscanf
> functions?
adebaene@club-internet.fr - 12 Jul 2005 13:20 GMT
ATS a écrit :
> INF: Has anyone made a CString, sprintf, and sscanf for .NET?
>
[quoted text clipped - 3 lines]
> Library. But I want CString, sprintf, and sscanf.  The "String" class in .NET
> is completely worthless to me, especially its so called "Format" method.

Have you tried System::Text::StringBuilder?

> With that said, PLEASE DO NOT RESPOND TO THIS ISSUE IN REGARDS TO DOING
> ANYTHING WITH .NET "String". ACCEPT IT. IT LEAVES A LOT FOR ME TO DESIRE.

This kind of position is not generally the good way to receive help on
newsgroups....

Arnaud
MVP - VC
ATS - 12 Jul 2005 13:52 GMT
Thanks everyone for the reply,

Sadly, no replies helped.

Could someone please forward to Microsoft my "wish" that .NET have a CString
class just like the MFC version, and sprintf and sscanf.

Thanks.
Carl Daniel [VC++ MVP] - 12 Jul 2005 14:57 GMT
> Thanks everyone for the reply,
>
> Sadly, no replies helped.
>
> Could someone please forward to Microsoft my "wish" that .NET have a
> CString class just like the MFC version, and sprintf and sscanf.

Do it yourself -

http://lab.msdn.microsoft.com/productfeedback

-cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.