Using VC6 code in VS 2005



I'm trying to reuse a database class module that I created with VC 6.0 in
Visual Studio 2005 and I'm getting a whole bunch of errors and warnings.
Most of them refer to data types being different than the current
definitions of functions that I'm using.

Examples:

If I cursor over SqlDriverConnect(..) the Intellisense says "#define
SqlDriverConnect SqlDriverConnectW" and the compiler balks at my connect
string being a char array. How do I "undefine" that?

Same with MessageBox now being #defined as MessageBoxW, and the compiler
won't accept literal strings or char arrays as parameters.

Some functions give errors like "cannot convert from 'char[80]' to 'LPTSTR'.
Both are char strings, no?

This one blows my mind:
// convert CString to number

int NumRecords = atoi(num_records.GetBuffer(3));

Compiler says atoi cannot convert parameter 1 from 'w_char_t' to 'const
char*'. Huh? CString::GetBuffer() dosn't return char any more?

I also get a slew of warnings about "depreciated" functions like strcpy and
strcat. I don't care, I use them.

Is there any way to set the compiler to use the old definitions, so I don't
have to rewrite my class module?

Thanks.


.



Relevant Pages

  • Re: Using VC6 code in VS 2005
    ... connect string being a char array. ... compiler won't accept literal strings or char arrays as parameters. ... I also get a slew of warnings about "depreciated" functions like ...
    (microsoft.public.vc.language)
  • Re: Delimited String to Array
    ... The casting is not required, and neither is the parsing of the string ... to make explicit what the compiler does implicitly: ... new char array, then loading it with the first character of a string. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How is strlen implemented?
    ... >>>that strlen can still return the number of characters of a char array. ... >> Your compiler is either not standard compilant, ... Of course, if the string were zero length, then.... ... CLC FAQ ...
    (comp.lang.c)
  • Re: structs for data transfer?
    ... > John Harrison wrote: ... >> Write some code to convert the struct you want to send into a char array. ... or sentinels and delimeters for the ends of strings. ...
    (comp.lang.cpp)
  • Re: Sanity check on call to imported DLL function
    ... "Default Marshaling for Strings", there is a subsection "Strings Used ... struct StringInfoT { ... public String f1; ... I'll try the char array ...
    (microsoft.public.dotnet.languages.csharp)

Loading