Hi ,
is this correct to have final LPTSTR to char *
CString fname(argv [1]);
LPTSTR p1 = fname.GetBuffer(fname.GetLength());
char teststr[1000];
sprintf(teststr,"%s",p1); //or
strcpy(teststr,p1);
is this code to have my null terminated teststr.
Thanks
free2cric 3 12559
free2cric wrote: Hi , is this correct to have final LPTSTR to char *
CString fname(argv [1]); LPTSTR p1 = fname.GetBuffer(fname.GetLength()); char teststr[1000]; sprintf(teststr,"%s",p1); //or strcpy(teststr,p1);
is this code to have my null terminated teststr. Thanks free2cric
Much better is to use std::string class and c_str() method.
I agree with the others regarding string. However, if you are stuck on
CString's, you can do
CString fname(argv[1]);
char teststr[1000];
strcpy( teststr, (LPCTSTR) fname );
"free2cric" <fr*******@yahoo.com> wrote in message
news:e8**************************@posting.google.c om... Hi , is this correct to have final LPTSTR to char *
CString fname(argv [1]); LPTSTR p1 = fname.GetBuffer(fname.GetLength()); char teststr[1000]; sprintf(teststr,"%s",p1); //or strcpy(teststr,p1);
is this code to have my null terminated teststr. Thanks free2cric This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sorty |
last post by:
Hi,
I have read in many places that TCHAR can be 'char' or 'wchar_t'
depending on ANSI or UNICODE.
I have also read that LPTSTR is a long pointer to a TCHAR.
I am confused about the...
|
by: alex |
last post by:
how do i initialize an LPTSTR variable?
i'm trying to call a microsoft function
LONG QueryStringValue(
LPCTSTR pszValueName,
LPTSTR pszValue,
ULONG* pnChars
) throw( );pszValue is supposed...
|
by: free2cric |
last post by:
Hi ,
is this correct to have final LPTSTR to char *
CString fname(argv );
LPTSTR p1 = fname.GetBuffer(fname.GetLength());
char teststr;
sprintf(teststr,"%s",p1); //or
strcpy(teststr,p1);
...
|
by: Steven Blair |
last post by:
Hi there.
Having a problem calling a win32 function from a dll.
Here is the function header:
DWORD thrdGetHcNum (DWORD nPort, DWORD nBaudrate, LPTSTR lpszHcNum)
//Description of the 3rd...
|
by: Mark |
last post by:
Help please... i am VERY new to the managed C++ and i need to take a
System::String* and cast it to an LPTSTR how might i do this? I have
searched the web and groups but cannot find any examples....
|
by: Lewap |
last post by:
Hi!
I've piece of code like follow:
<code>
LPTSTR lpszPipename = (LPTSTR) "\\\\.\\pipe\\testpipe";
hPipe = CreateNamedPipe(
|
by: **Developer** |
last post by:
Been reading some of the Marshal doc and am a little confused.
Anyway, I've been using the following and it works OK.
Public Declare Auto Function SHGetFolderPath Lib "shell32.dll" (ByVal hWnd...
|
by: pskumaran |
last post by:
Hi All,
I am trying to convert LPTSTR to char* by using sprintf,
But sprintf copies only the first character from the string. i tried both array and pointer also , but the result is same. Here is...
|
by: sudhivns |
last post by:
Hi,
How to convert LPTSTR to char*.?
Thanks in advance.
Bye
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |