Some question about CString,Unicode,and TCHAR *

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason .Y

    #1

    Some question about CString,Unicode,and TCHAR *

    Hi~I'm planning to make a smiple program to upload file,but I've
    traped by a strange problem,here is a chip of my program:
    =============== =============== =============
    LPCTSTR lpszMyFilePath =COptions::Stor agePath+_T("\\t est\\")+pWData-
    >cFileName;
    LPCTSTR lpszPeerFilePat h = pWData->cFileName;

    UINT nMyTaskID = 0;

    nMyTaskID = WRMCC_RequestUp loadFile (/*_T("\\´æ´¢¿¨\\ test\
    \20080618.dat") */lpszMyFilePath, lpszPeerFilePat h, FTNOTIFY_Callba ck );

    ==============
    When I was using _T("\\´æ´¢¿¨\\t est\\20080618.d at") as LParm,the program
    work successfully.bu t when I use lpszMyFilePath, which i defined myself
    above,the server said "File not exist"

    P.S.
    COptions::Stora gePath is a instance of CString

    cFileName is a name of TCHAR[ ] array

    and the type of upload function is:
    UINT WRMCC_RequestUp loadFile ( LPCTSTR lpszMyFilePath, LPCTSTR
    lpszPeerFilePat h=NULL, FUNC_FTNOTIFY_C allback
    Proc_FTNOTIFY_C allback=NULL, BOOL bForceRetransmi t=FALSE );
  • Ian Collins

    #2
    Re: Some question about CString,Unicode ,and TCHAR *

    Jason .Y wrote:

    [lots of windows stuff]

    Try a windows group, this isn't standard C++.

    --
    Ian Collins.

    Comment

    • cooleaf

      #3
      Re: Some question about CString,Unicode ,and TCHAR *

      LPCTSTR is only a pointer which point to the temp string,
      COptions::Stora gePath+_T("\\te st\\")+pWData-cFileName; will construct
      a temp CString ,but after that it will be destroyed, and the pointer
      will point to a invalid memory.


      by the way, please do not post Chinese charator in your question, here
      is a international mailist, so many people can not read in Chinese.



      On Jul 31, 11:16 am, "Jason .Y" <lin.yang.ja... @gmail.comwrote :
      Hi~I'm planning to make a smiple program to upload file,but I've
      traped by a strange problem,here is a chip of my program:
      =============== =============== =============
      LPCTSTR lpszMyFilePath =COptions::Stor agePath+_T("\\t est\\")+pWData-
      >
      cFileName;
      >
      LPCTSTR lpszPeerFilePat h = pWData->cFileName;
      >
      UINT nMyTaskID = 0;
      >
      nMyTaskID = WRMCC_RequestUp loadFile (/*_T("\\´æ´¢¿¨\\ test\
      \20080618.dat") */lpszMyFilePath, lpszPeerFilePat h, FTNOTIFY_Callba ck );
      >
      ==============
      When I was using _T("\\´æ´¢¿¨\\t est\\20080618.d at") as LParm,the program
      work successfully.bu t when I use lpszMyFilePath, which i defined myself
      above,the server said "File not exist"
      >
      P.S.
      COptions::Stora gePath is a instance of CString
      >
      cFileName is a name of TCHAR[ ] array
      >
      and the type of upload function is:
      UINT WRMCC_RequestUp loadFile ( LPCTSTR lpszMyFilePath, LPCTSTR
      lpszPeerFilePat h=NULL, FUNC_FTNOTIFY_C allback
      Proc_FTNOTIFY_C allback=NULL, BOOL bForceRetransmi t=FALSE );

      Comment

      • Jason .Y

        #4
        Re: Some question about CString,Unicode ,and TCHAR *

        On Jul 31, 1:05 pm, cooleaf <cool...@gmail. comwrote:
        LPCTSTR is only a pointer which point to the temp string,
        COptions::Stora gePath+_T("\\te st\\")+pWData-cFileName; will construct
        a temp CString ,but after that it will be destroyed, and the pointer
        will point to a invalid memory.
        >
        by the way, please do not post Chinese charator in your question, here
        is a international mailist, so many people can not read in Chinese.
        >
        On Jul 31, 11:16 am, "Jason .Y" <lin.yang.ja... @gmail.comwrote :
        >
        >
        >
        Hi~I'm planning to make a smiple program to upload file,but I've
        traped by a strange problem,here is a chip of my program:
        =============== =============== =============
        LPCTSTR lpszMyFilePath =COptions::Stor agePath+_T("\\t est\\")+pWData-
        >
        >cFileName;
        >
        LPCTSTR lpszPeerFilePat h = pWData->cFileName;
        >
        UINT nMyTaskID = 0;
        >
        nMyTaskID = WRMCC_RequestUp loadFile (/*_T("\\´æ´¢¿¨\\ test\
        \20080618.dat") */lpszMyFilePath, lpszPeerFilePat h, FTNOTIFY_Callba ck );
        >
        ==============
        When I was using _T("\\´æ´¢¿¨\\t est\\20080618.d at") as LParm,the program
        work successfully.bu t when I use lpszMyFilePath, which i defined myself
        above,the server said "File not exist"
        >
        P.S.
        COptions::Stora gePath is a instance of CString
        >
        cFileName is a name of TCHAR[ ] array
        >
        and the type of upload function is:
        UINT WRMCC_RequestUp loadFile ( LPCTSTR lpszMyFilePath, LPCTSTR
        lpszPeerFilePat h=NULL, FUNC_FTNOTIFY_C allback
        Proc_FTNOTIFY_C allback=NULL, BOOL bForceRetransmi t=FALSE );- Hide quoted text -
        >
        - Show quoted text -
        I'm sorry for my ruleless post,and thank you very much for your
        assistance.

        Comment

        Working...