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 293215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:15:05+00:00 2026-05-12T06:15:05+00:00

I am using TCHAR buffer[MAX_SIZE]; after some set of steps i am gettig the

  • 0

I am using

TCHAR buffer[MAX_SIZE];

after some set of steps i am gettig the relative path of folder say for ex:

c:\Microsoft.NET\Framework\v1.0.037\

Since the above path is in buffer of type TCHAR and i am trying to concatenate“RegAsm.exe”

After Appending i need to convert the path to the LPCTSTR since i need to pass it to
CreateProcess() which takes LPCTSTR type as argument

then the compiler giving error.I have tried but vexed.

can any one help me in this aspect….

  • 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-12T06:15:06+00:00Added an answer on May 12, 2026 at 6:15 am

    The problem is TCHAR and CreateProcess are macros that expand differently depending on whether you compile for Unicode or not. The caveat is that GetCORSystemDirectory() will only accept a Unicode buffer. To get rid of these ANSI/Unicode problems write this code part explicitly for Unicode.

    Instead of TCHAR use WCHAR for the buffer. Instead of CreateProcess() use CreateProcessW() – it will happily accept the Unicode buffer. Use wcscat() for strings concatenation.

    Something like this (error handling omitted):

     WCHAR buffer[MAX_PATH + 1];
     DWORD realLength;
     GetCORSystemDirectory( buffer, MAX_PATH, &realLength );
     *( buffer + realLength ) = 0;// Don't forget to null-terminate the string
     wcscat( buffer, L"regasm.exe" );
     CreateProcessW( /*pass buffer here*/ );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following function ..instead of CFolderDialog.. to get the folder path...check
Using LPTSTR strDLLPath1 = new TCHAR[_MAX_PATH]; ::GetModuleFileName((HINSTANCE)&__ImageBase, strDLLPath1, _MAX_PATH); I get path to my
By default Microsoft's Visual Studio is using <tchar.h> and defines main as int _tmain(int
Here's a very simple program using the function: #include <windows.h> #include <tchar.h> #include <atlstr.h>
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
I have a chunk of code that I'm using to get the UNC path
Im trying to implement the bag of words approach using opencv. After making the
Using this code snippet: TCHAR buf[255] = {0}; DWORD dwBufSize = sizeof(buf); HKEY hKey
I have // file BoardInitializer.h #include <stdio.h> #include <tchar.h> #include <string> #include <iostream> using
Must I free structure memory after using it? I have sample code: struct aa

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.