CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Apr 2001
    Posts
    1,029

    How to use std::string with GetCurrentDirectory()?

    Hello all,

    I have the following code that works in Debug mode in my program, but not in Release mode:

    Code:
    CString dir;
    GetCurrentDirectory(1000, dir.GetBufferSetLength(1000));
    string path = string(CT2CA(dir)) + "\\tempdir\\test1.jpg";
    In Release mode the CT2CA() call returns garbage.

    Any idea why or how best to fix this to work with std::string??

    Thanks!
    Last edited by lab1; March 13th, 2011 at 12:33 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured