Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Convert ansiString to char

Hi,
I must convert a string to a char, but i tried many ways to do it, but
nothing is working... I also tried with strcpy.

Ex:
String incomingFileName= ParamStr(1);
String longNameFile="PT_RP_"+numMess+"020010210"

char *convertincomingFileName[255]
char *convertLongName[255];


// Convert the 2 strings into char....
// How can I convert that???

//

//Then I must call a dll with the 2 parameters, but the dll is asking for const char*
void (__stdcall *BFEncFile)(const char*,const char*,const char*);
HINSTANCE dllInstance = LoadLibrary("crypto.dll");
BFEncFile = (void (__stdcall *)(const char*,const char*,const char*)) GetProcAddress(dllInstance,"BFEncFile");
BFEncFile(convertincomingFileName,convertLongName,"yOwq/yfHj7e");
// End of file

Thank you for your help!
Sylvain

Comments

  • PeterTheMasterPeterTheMaster Member Posts: 636
    what is String? why not use the standard std::string? then the conversion to const char* is as easy as calling string::c_str().

    : Hi,
    : I must convert a string to a char, but i tried many ways to do it, but
    : nothing is working... I also tried with strcpy.
    :
    : Ex:
    : String incomingFileName= ParamStr(1);
    : String longNameFile="PT_RP_"+numMess+"020010210"
    :
    : char *convertincomingFileName[255]
    : char *convertLongName[255];
    :
    :
    : // Convert the 2 strings into char....
    : // How can I convert that???
    :
    : //
    :
    : //Then I must call a dll with the 2 parameters, but the dll is asking for const char*
    : void (__stdcall *BFEncFile)(const char*,const char*,const char*);
    : HINSTANCE dllInstance = LoadLibrary("crypto.dll");
    : BFEncFile = (void (__stdcall *)(const char*,const char*,const char*)) GetProcAddress(dllInstance,"BFEncFile");
    : BFEncFile(convertincomingFileName,convertLongName,"yOwq/yfHj7e");
    : // End of file
    :
    : Thank you for your help!
    : Sylvain
    :
    :

  • Justin BibJustin Bib USAMember Posts: 0

    _ // http://forcoder.org // free ebooks and video tutorials about [ C# Scratch MATLAB Perl JavaScript Visual Basic .NET Objective-C Swift Assembly C++ PL/SQL Go Ruby Visual Basic Delphi Python Java R PHP C Crystal F# Lua Scheme D FoxPro ABAP Logo COBOL LabVIEW Lisp Fortran Prolog SAS VBScript Alice ML Erlang Kotlin Awk Julia Apex Ada Bash Scala Clojure Hack Dart Transact-SQL Rust ] ______

Sign In or Register to comment.