C/C++ Windows API

Moderators: Lundin
Number of threads: 450
Number of posts: 1225

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
String Conversion Posted by mcertini on 25 Jan 2011 at 8:20 PM
I am currently trying to convert a string that resides in a _bstr_t variable vFieldDate into a char array. I have found that I can type cast this via the (char *) with a variable I named holder which is a pointer to a char. The issue I am having a hard time solving is how to convert this to a char that can be stored within the char Date[ARR]. When I attempt the following code I get the compilation error "Cannot Convert From Char * to Char. How do I extract the value that resides in the holder location and save it into the array?

Date[cyc] = holder;

The below portions of code are a part of an ADO program that is accessing data from a database.

char Date[ARR] = {};
_bstr_t vFieldDate;
vFieldDate = rec->Fields->GetItem("Date")->Value;
char *holder = (char*)vFieldDate;


Report
Re: String Conversion Posted by mcertini on 25 Jan 2011 at 9:30 PM
This question has been anwered with:

#include <cstring>
//...
strcpy( Date, holder );




 

Recent Jobs