473,287 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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 12208

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::ostringstream and get the string with method str() from there

Jan 10 '07 #2
<va************@gmail.comwrote in message
news:11**********************@o58g2000hsb.googlegr oups.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.googlegr oups.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.googlegr oups.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("Hellow")
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::ostringstream 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
by: Karthik | last post by:
Hello, How can I convert a BSTR data type to std::string??? Thanks a much! Karthik
16
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
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...
10
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*...
2
by: Abhishek | last post by:
how to do convert a std::string to LPTSTR (chat *) datatype regards Abhishek
10
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...
3
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...
11
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
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";
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.