Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6929061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:16:11+00:00 2026-05-27T11:16:11+00:00

I am creating a VC++2008 Windows Form Application which needs to use some of

  • 0

I am creating a VC++2008 Windows Form Application which needs to use some of classes from our VC6 project.

When I added one file which contains the following method:

bool Property::createPaths(string &sPaths)
{
    char *tok = NULL;
    char seps[] = "\\";
    string str;
    if (sPaths.size() > 0)
    {
        tok = strtok((char*)sPaths.c_str(),seps);
        str  = tok;
        while (tok != NULL)
        {
            int res = CreateDirectory(str.c_str(),NULL);
            tok = strtok(NULL,seps);
            if (tok != NULL)
            {
                str += "\\";
                str += tok;
            }
        }
        return true;
    }
    return false;
}

I got error complain the CreateDirectory call:

*error C2664: ‘CreateDirectory’ : cannot convert parameter 1 from ‘const char ‘ to ‘LPCTSTR’

Searched online, seems I need some configuration on my VC2008 project to fix this. Anybody can tell me where and how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:16:11+00:00Added an answer on May 27, 2026 at 11:16 am

    You are passing a const char* to a function expecting a TCHAR*.

    TCHAR is defined as either char or wchar_t depending on the compilation settings – and by default in VC2008 it is wchar_t. Your use of std::string assumes that TCHAR is char, which causes the error you see.

    There are two reasonable fixes available to you:

    • In your project settings, change Configuration Properties/General/Character Set to Use Multi-Byte Character Set.

    Or

    • Refactor your code to account for the potentially different definitions of TCHAR – you’d start this by replacing any use of std::string or std::wstring with std::basic_string<TCHAR> (using an appropriate typedef) and wrap string literals in the _T or _TEXT macro.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently use visual studio 2008 for creating projects that can run on windows.
I am creating a Windows Mobile Application in C# and Visual Studio 2008. The
We are working to certify our application for deployment on Windows Server 2008 and
I've been creating a an application with C# using W2k8+IIS7/SQLExpress 2008/Web Service/Windows Client. I'll
I am working on a Windows Form-Based application in Visual Studio 2008 using C#
In Visual Studio 2008 (and others) when creating a .NET or silverlight application if
Im attempting to use Silverlight and MVC together. After creating a simple Silverlight application
I'm creating a windows app in c# 2008 that will have around 8-10 dialog
I am creating a web application for my company that needs to deal with
I'm creating a kinect project in Visual Studio 2008 using OpenNi, NITE and OpenGL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.