Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++ > Managed C++

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

Managed C++ Visual Studio .NET managed C++ Topics

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-27-2007, 09:00 AM
karateboy02 karateboy02 is offline
Newbie
 
Join Date: Jul 2007
Posts: 6
Credits: 0
Rep Power: 0
karateboy02 is on a distinguished road
Default Visual Studio 2003 convert System::String to char array

I am trying to convert from a System::String to a char array. I have found a code snippet that works in Visual Studio 2005 but when I try to run the same exact code in Visual Studio 2003 I get several errors. The code looks like:


System::String *orig = this->textBox1->Text;
pin_ptr<const wchar_t> wch = PtrToStringChars(orig);

size_t origsize = wcslen(wch) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, wch, _TRUNCATE);


Where nstring should be where the string ends up. The errors that I get are:

(143): error C2065: 'pin_ptr' : undeclared identifier
(143): error C2059: syntax error : 'const'
(146): error C2065: 'wch' : undeclared identifier
(150): error C2065: '_TRUNCATE' : undeclared identifier
(150): error C3861: 'wcstombs_s': identifier not found, even with argument-dependent lookup
(150): error C3861: 'wch': identifier not found, even with argument-dependent lookup

Any help would be much appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2008 Express Beta 2 Download Jordan Programming News 2 08-03-2007 01:05 PM
Visual Studio 2005 and Windows Vista Jordan General Programming 3 01-22-2007 03:21 PM
Visual Studio 2005 Pro Won't Install CheeseBurgerMan Software Development Tools 10 09-22-2006 05:44 PM
Visual Studio .NET Tips and Tricks free ebook Jordan Software Development Tools 2 09-14-2006 02:12 PM
Visual Studio 2005 Express Edition Crane Software Development Tools 9 05-25-2006 06:17 PM


All times are GMT -5. The time now is 07:26 PM.

Contest Stats

Xav ........ 1333.07
MeTh0Dz|Reb0rn ........ 1055.7
John ........ 881.37
morefood2001 ........ 879.43
marwex89 ........ 869.98
WingedPanther ........ 851.68
Brandon W ........ 757.44
chili5 ........ 312.39
Steve.L ........ 247.05
dcs ........ 219.87

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads