Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-01-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Using Char* with SLICE

Hi.

Need some help. Because of the nature of some libraries I have to call with ICE, I had to make a slice script this way:
Quote:
interface jSockets
{
char* jclCommand(char* command);
};
Slice complained that it doesnt know "char*". How do I convert a char* to ::std::string and back? Is there another way?

Thanks for the help.

Alex
Reply With Quote
  #2 (permalink)  
Old 08-01-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,772
You can convert an std::string to const char* with the c_str() function. And you can convert a const char* (or char*) to an std::string simply by passing the const char* as an argument to the std::string constructor.

Note that this doesn't have anything to do with Ice, that's simply standard C++.
Reply With Quote
  #3 (permalink)  
Old 08-01-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Hello Marc,

Thanks for the info. I've been combing the internet for solutions and there are a lot of complicated ones. Your suggestion looks to be the simplest one. I'll implement it as soon as I get to the office tomorrow.

Oh, I do know that this isn't an ICE problem, but considering I'm primarily a VB programmer ... I acknowledge that I'm way out of my league. Unfortunately, our office doesn't have any C++ programmer, I'm doing ICE integration on my own time and all of my colleagues are VB programmers ... your site/forum is the only place I can discuss these issues I encounter while programming C++ with ICE.

Thanks again.

Alex
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with char ':' in identity.name xdm Help Center 4 06-20-2006 04:12 AM
Casting char* to std::string inmmat Help Center 5 06-10-2006 01:43 PM
Is this a bug? (Wide char) while(1){} Help Center 4 01-05-2006 07:27 AM
I need char pointers (char *) catalin Help Center 5 08-16-2004 04:33 PM
Application.h compiler error on int main(int, char*[], const char* = 0); Jonathan Dzoba Bug Reports 4 05-28-2004 05:52 PM


All times are GMT -4. The time now is 07:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.