473,799 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can we convert the RWCString to std::string? If yes how?

I want to convert the message of type RWCString to std::string type.
How can we do this?

Jan 10 '07 #1
7 12288

va************@ gmail.com napsal:
I want to convert the message of type RWCString to std::string type.
How can we do this?
Since RWCString is not C++ standard class, there is no C++ standard way
how to do it. I do not know RWCString, so I can only guess:

- look into RWCString documentation and try to find there some
converting function
- there may be also some method, whcih gives the buffer occupied by
RWCString. This may be used as one input parameters for std::string
- if RWCString can be written into output stream, you can srite it to
std::ostringstr eam and get the string with method str() from there

Jan 10 '07 #2
<va************ @gmail.comwrote in message
news:11******** **************@ o58g2000hsb.goo glegroups.com.. .
>I want to convert the message of type RWCString to std::string type.
How can we do this?
I googled for RWCString, and see it has an operator char*. So:
std::string MyString( RWCString );
*should* work.
Jan 10 '07 #3
Thanks to you both it is working. But i need to check if it works for
large message stream
..
Jim Langston wrote:
<va************ @gmail.comwrote in message
news:11******** **************@ o58g2000hsb.goo glegroups.com.. .
I want to convert the message of type RWCString to std::string type.
How can we do this?

I googled for RWCString, and see it has an operator char*. So:
std::string MyString( RWCString );
*should* work.
Jan 10 '07 #4
then read a very large text file and test it,
it's easy to find out if it works for huge strings.

On Jan 10, 9:42 pm, "varsha.gade... @gmail.com"
<varsha.gade... @gmail.comwrote :
Thanks to you both it is working. But i need to check if it works for
large message stream
.

Jim Langston wrote:
<varsha.gade... @gmail.comwrote in message
news:11******** **************@ o58g2000hsb.goo glegroups.com.. .
>I want to convert the message of type RWCString to std::string type.
How can we do this?
I googled for RWCString, and see it has an operator char*. So:
std::string MyString( RWCString );
*should* work.
Jan 10 '07 #5
Jim Langston wrote:
I googled for RWCString, and see it has an operator char*. So:
std::string MyString( RWCString );
*should* work.
This won't work if the string contains character with ascii value 0.
In this case you need the length of RWCString as well.

Jan 10 '07 #6
You can use the data() function of RWCString class to get char *

RWCString testString("Hel low")
cout << testString.data ()

You can use this further to initialise std::string objects. Hope this
helps.

Ondra Holub wrote:
va************@ gmail.com napsal:
I want to convert the message of type RWCString to std::string type.
How can we do this?

Since RWCString is not C++ standard class, there is no C++ standard way
how to do it. I do not know RWCString, so I can only guess:

- look into RWCString documentation and try to find there some
converting function
- there may be also some method, whcih gives the buffer occupied by
RWCString. This may be used as one input parameters for std::string
- if RWCString can be written into output stream, you can srite it to
std::ostringstr eam and get the string with method str() from there
Jan 10 '07 #7

Frank Potter wrote in message ...
>then read a very large text file and test it,
it's easy to find out if it works for huge strings.
Do not top-post!

{
std::string Tst("");
std::cout<<"Tst .max_size()="<< Tst.max_size()< <std::endl;
}

--
Bob R
POVrookie
Jan 10 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
48706
by: Karthik | last post by:
Hello, How can I convert a BSTR data type to std::string??? Thanks a much! Karthik
16
16431
by: Khuong Dinh Pham | last post by:
I have the contents of an image of type std::string. How can I make a CxImage object with this type. The parameters to CxImage is: CxImage(byte* data, DWORD size) Thx in advance
8
12166
by: ppcdev | last post by:
Here's what I try : LPCTSTR tst = (LPCTSTR) (LPCWSTR) Marshal::StringToHGlobalUni(str); c:\MyNetPrj\Prj0001\stunt.cpp(244): error C2440: 'type cast' : cannot convert from 'System::IntPtr' to 'LPCWSTR' I really get mad with that !!!
10
26649
by: sposes | last post by:
Im very much a newbie but perhaps somehone can help me. Ive been searching for a way to convert a std::string to a unsigned char* The situation is I have a function that wants a unsigned char* and I want to give it a std::string no matching function for call to `MD5::update(std::string&, size_t)' candidates are: void MD5::update(unsigned char*, unsigned int) void PrintMD5(string str){
2
12191
by: Abhishek | last post by:
how to do convert a std::string to LPTSTR (chat *) datatype regards Abhishek
10
10142
by: Jeffrey Walton | last post by:
Hi All, I've done a little homework (I've read responses to similar from P.J. Plauger and Dietmar Kuehl), and wanted to verify with the Group. Below is what I am performing (Stroustrup's Appendix D recommendation won't compile in Microsoft VC++ 6.0). My question is in reference to MultiByte Character Sets. Will this code perform as expected? I understand every problem has a simple and elegant solution that is wrong.
3
40708
by: timor.super | last post by:
Hi group, how to convert a string to a vector of unsigned char ? I used to iterate trough the string to set the vector, but I think this is not the best way to do this. I'm a beginner with the STL How about allocating the vector ? should I know before the size ? And I would like to do then opposite conversion, from an unsigned char
11
5060
by: Sudzzz | last post by:
Hi, I'm trying to convert a string something like this "{201,23,240,56,23,45,34,23}" into an array in C++ Please help. Thanks, Sudzzz
4
17379
by: Man4ish | last post by:
HI , I am trying to convert string into char array of characters.but facing problem. #include <iostream> #include <string> using namespace std; int main() { string t="1,2,3,4,5,6";
0
9687
marktang
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...
0
10257
jinu1996
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...
1
10237
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,...
0
10029
tracyyun
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...
0
9077
agi2029
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...
0
6808
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();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.