473,386 Members | 1,715 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,386 software developers and data experts.

dumb question about String

TGF
How do you copy a String type into a native char buffer[256]? Dumb
question, but not sure how to do it :(

TGF

Nov 16 '05 #1
2 1280
nn
Hello,

Use ToCharArray method of String.

Regards
-----Original Message-----
How do you copy a String type into a native char buffer [256]? Dumbquestion, but not sure how to do it :(

TGF

.

Nov 16 '05 #2
TGF,
How do you copy a String type into a native char buffer[256]? Dumb
question, but not sure how to do it :(


If you don't mind an extra buffer copy, you can use the Marshal class in the
System::Runtime::InteropServices namespace, with the StringToAnsiHGlobal(),
then just use strncpy or another like method.

Otherwise, another option would be to use PtrToStringChars() in vcclr.h, pin
the returned pointer, and then use a Unicode-to-ansi conversion function
(such as WideCharToMultiByte) directly unto your array.

--
Tomas Restrepo
to****@mvps.org
Nov 16 '05 #3

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

Similar topics

3
by: Serious_Practitioner | last post by:
Good morning, and thank you in advance. Using Access 2000 with all updates applied through last weekend. OS is XP Home. tblPlayers has only one field - it holds names of actors and actresses...
3
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
6
by: wASP | last post by:
Hello everyone, I'm new to C# and ASP.NET, so pardon my stupidity on this one. I'm having a problem with referencing methods/functions external to a class member function. My code is as...
11
by: dhnriverside | last post by:
Hi peeps Ok, so I thought I'd have a go at making a console app in VS2k5... I haven't written any windows apps for years, let alone dos apps (been web programming) and I've hit a dumb error... ...
8
by: Fred Hebert | last post by:
I have a function that requires a LPCTSTR parameter. I have the value I want to pass to it in a TextBox->Text field. Is there any way to do it in a single assignment. e.g. DWORD...
1
by: Chris | last post by:
Dumb question about c# web services Posted on: 11/30/2005 12:14:16 Ok guys, here is what I am trying to do or what I need to know. I am creating a webservice called db_update. This...
16
by: CMM | last post by:
Is it me or has anyone noticed that F1 is really dumb in VS2005. Since VB3 I have been able to click F1 on an ambiguous method in code and the IDE automatically determines the type based on the...
3
by: Nonee | last post by:
Ok ok... I have been staring at this for a generation or so now and it is not working. And it is something really simple too. I have a listbox of mp3s (flbMp3s). I have a textbox (txtSearch). I...
9
by: Bob | last post by:
In a sub Private Mysub (string strLang) { if (strLang = "FR") Won't compile. strLang is declared as string in the sub's parameter collection.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.