473,473 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Strings between C# and managed C++

How can I send a string between C# to managed C++ and vice versa?
Mar 5 '07 #1
4 2208
I have to add that I cannot use

using namespace System;

at the top since I'm using

#include <windows>

needed by a third party, unmanaged library.

"Joachim" wrote:
How can I send a string between C# to managed C++ and vice versa?
Mar 5 '07 #2
put windows.h in your stdaffx.h and above any using statement
undef SDK macros if necessary
--
Regards
Sheng Jiang
Microsoft MVP in Visual C++
"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
>I have to add that I cannot use

using namespace System;

at the top since I'm using

#include <windows>

needed by a third party, unmanaged library.

"Joachim" wrote:
>How can I send a string between C# to managed C++ and vice versa?

Mar 5 '07 #3

"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
>I have to add that I cannot use

using namespace System;

at the top since I'm using

#include <windows>

needed by a third party, unmanaged library.
So put "using namespace System;" further down your program, maybe inside
your own namespace, so it won't conflict with foreign header files.
>
"Joachim" wrote:
>How can I send a string between C# to managed C++ and vice versa?

Mar 5 '07 #4
Or just explicitly qualify the type name System::String, depending on how
often you use it.

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:uz**************@TK2MSFTNGP04.phx.gbl...
>
"Joachim" <Jo*****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
>>I have to add that I cannot use

using namespace System;

at the top since I'm using

#include <windows>

needed by a third party, unmanaged library.

So put "using namespace System;" further down your program, maybe inside
your own namespace, so it won't conflict with foreign header files.
>>
"Joachim" wrote:
>>How can I send a string between C# to managed C++ and vice versa?


Mar 7 '07 #5

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

Similar topics

10
by: Ian Todd | last post by:
Hi, I am trying to read in a list of data from a file. Each line has a string in its first column. This is what i want to read. I could start by saying char to read in 1000 lines to the array( i...
2
by: Peter Nolan | last post by:
Hi All, I have some older C++ code that reads databases via ODBC and converts data to C++ null delimited strings. I amd writing a tool to read these types of old C strings and update an XML file....
0
by: Peter Nolan | last post by:
Hi All, I've been reading through this newsgroup and found the interoperability services I've included the following code that the top of the program but I get the message below. Anyone have...
7
by: Bob Rock | last post by:
Hello, converting from the managed to the unmanaged world (and viceversa strings) and byte arrays is something I do often and I'd like to identify the most correct and efficient way to do it....
6
by: vladislavf | last post by:
Hi All, I need to pass array of strings from C++/CLI to unmanaged C++ function. (The unmanaged API signatire is : int Combine(int NumOfInputFiles, wchar_t **names) and I want to call it from...
2
by: MTL | last post by:
I've created a managed wrapper class for a c++ .dll i want to call from a c-sharp project. It works fine except that any static strings that are created within any of the classes of my c++ .dll...
12
by: Kim Hellan | last post by:
I come from C# development, but I have to make a .NET WinForm application in C++. I'm having some troubles handling strings in C++, which seems a lot more problematic than in C#. Lets say I want...
95
by: hstagni | last post by:
Where can I find a library to created text-based windows applications? Im looking for a library that can make windows and buttons inside console.. Many old apps were make like this, i guess ...
6
by: Andy Baker | last post by:
I am attempting to write a .NET wrapper for a C++ DLL file, but am having problems with passing strings as parameters. How should I be writing my C# function call when the C header file is...
4
by: MichK | last post by:
Hello all, I'm having some problems passing strings to a native (unmanaged) c++ dll I've written. There are lots of examples I can find on the internet considering passing strings to char*, yet I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
1
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...
0
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...
0
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,...
1
isladogs
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.