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? 6 3098
ATS wrote: 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 *'
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 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?
Go for it. IMO the .NET string/formatting classes already provide far more
capability that CString/sprintf/sscanf, but YMMV.
-cd
ATS wrote: 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 *'
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 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?
Go for it. IMO the .NET string/formatting classes already provide far more
capability that CString/sprintf/sscanf, but YMMV.
-cd
Have you seen this article? http://www.codeproject.com/csharp/CsScanf.asp
--
Regards,
Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"ATS" <AT*@discussion s.microsoft.com > wrote in message
news:8A******** *************** ***********@mic rosoft.com... 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?
ATS a écrit : 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.
Have you tried System::Text::S tringBuilder?
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
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.
ATS wrote: 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Smith |
last post by:
Hi all,
I have a char buff which contains "1234 ABCD 5678".
I can't remember what function I used before to parse the string into
individual variables. It was something like this:
forgotenFunction(var1, var2, var3, buff, "%d %s %d")
It gave me this:
|
by: pramod |
last post by:
Two different platforms communicate over protocols which consist of
functions and arguments in ascii form. System might be little
endian/big endian.
It is possible to format string using sprintf and retreive it using
sscanf.
Each parameter has a delimiter, data type size is ported to the
platform, and expected argument order is known.
Is this approach portable w.r.t. endianess ?
|
by: jimjim |
last post by:
Hello,
I was wondering about the implications of giving as an argument to sprintf a
different data type from the one specified in the format argument. This type
of question along with some others are asked below:
1. #include <stdio.h>
int main(){
char buffer;
|
by: ATS |
last post by:
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:
|
by: tjay |
last post by:
Hi. I wrote some code using sprintf and atof to store a double as a
string of fixed length and to convert it back to a double variable. The
string is stored in a char buffer global variable. I'm afraid it might
contain bugs though.
If I serialize a double, I get a string of the format
"-1.0000000000000000e+212". This string gets stored in the buffer.
Then, to convert it back into a double, I pass it to the atof function.
The problem...
| |
by: Carson |
last post by:
Is it possible to remove the dashes in a social security number using
sprintf? If so what would the syntax look like? If sprintf won't do
this is there a C function that will?
|
by: gyan |
last post by:
Hi All,
I am using sprintf and getting starnge output in following case
char temp_rn;
memset(temp_rn,'\0',12);
sprintf(temp_rn,"0%s",temp_rn);
the final value in temp_rn is 00
how it is behaving like this, when source string and output string is
|
by: Martin Manns |
last post by:
Hi,
I am experiencing some trouble with gmpy v1.01.
Multiplying an mpq with inf results in a floating point exception that
exits python. Has this already been fixed in newer gmpy versions?
~ $ python
Python 2.4.3 (#1, Mar 26 2007, 00:32:54)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
|
by: sas |
last post by:
hi,
i need that because the path functions for windows, like PathAppend
and PathRemoveFileExt accept a writable zero terminated char*, but i
didn't find that for std::string, with CString, i usually use
GetBuffer for that
LPTSTR CString::GetBuffer( int nMinBufLength )
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |