CString Formatting Problem in MFC
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CString Formatting Problem in MFC

  1. #1
    Join Date
    Jan 2010
    Posts
    49

    CString Formatting Problem in MFC

    Hi,

    Cant We Format a CString Variable in MFC Twice.

    Iam Getting Assertion in Following COde.

    CString sAppFile;
    sAppFile.Format("%s.dat", "E:\\VSS");
    sAppFile.Format(" IN-[%s] ", sAppFile);

    Iam Getting Assertion while running the code,Can ANyone Plz help me on this to understand.

    If I Continue after assertion Iam Getting Like below in Variable Window
    sAppFile = IN-[ннннннннннннннн]


    Thanks
    Abhi

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,990

    Re: CString Formatting Problem in MFC

    Code:
    sAppFile.Format(" IN-[%s] ", sAppFile);
    You can't use a string in formatting itself. You need to create a temporary string object instead:
    Code:
    sAppFile.Format(" IN-[%s] ", CString(sAppFile));
    Best regards,
    Igor

  3. #3
    Join Date
    Jan 2010
    Posts
    49

    Re: CString Formatting Problem in MFC

    Thanks alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center