|
Hi
I am trying to convert a long to a CString so that I can concatanate it as shown below
<br />
CString tmpMsg = "New CAMA Saved. CAMA ID = " + static_cast<CString>(m_NumericCAID.GetValue());<br />
<br />
where
<br />
m_NumericCAID.GetValue()<br />
returns a long. However I get compile errors. Any ideas on how to convert? Thanks.
|
|
|
|
|
minkowski wrote: I am trying to convert a long to a CString so that I can concatanate it as shown below
CString csLongAsString;
long lSomeLongValue = 100L;
csLongAsString.Format( _T( "Long as string: %ld" ), lSomeLongValue );
AfxMessageBox( csLongAsString )
|
|
|
|
|
look at CString::Format(...)
|
|
|
|
|
Hi all,
I would like to ask a superby newbie question...what is the meaning of the "L" in the _bstr_t(L"ROOT\\CIMV2")? I tried search for the answer but nothing seems to work out. And I would greatly appreciate if anyone would show me a path to find out how many methods I could input besides "ROOT\\CIMV2".
Thank you.
Regards,
Beginner
Hengshi
|
|
|
|
|
It states that the string is in UNICODE format. Same as _T("ROOT\\CIMV2") , if this is more telling.
|
|
|
|
|
hey thanx for the fast response, but is there any webbies which I can refer to for the letters and wordings?
|
|
|
|
|
teohs wrote: I would like to ask a superby newbie question...what is the meaning of the "L" in the _bstr_t(L"ROOT\\CIMV2")?
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
I want to queue a user APC to a thread in the other running process (code injection issue resolved), but it is never executed. I guess the problem is the thread never enter the alertable state. How can I force it to enter the alertable state and executed my queued APC?
However, if I create that foreign process with CREATE_SUSPEND, queue the APC to the primary thread, resume it, the APC will be executed as expected.
I know it's unusual because it's not the designed purpose of APC. The preempted thread may be in a unstable state when executing APC.
I know it can be done easily in the kernel mode, but I am looking for a userland solution. Maybe using some native APIs in NTDLL.DLL, but I've not got any luck.
(1)
SuspendThread(hThread);
QueueUserAPC(apcFunc, hThread, NULL);
NtAlertResumeThread(hThread, &suspendCount);
(2)
QueueUserAPC(apcFunc, hThread, NULL);
NtAlertThread(hThread);
Neither of the above two method works. Do I miss something?
|
|
|
|
|
hi all,
is there any api to check whether the file contains unicode, utf-8 or ansi characters?
|
|
|
|
|
IsTextUnicode() function can be used to check if the text is unicode...
The following code might help you:
<br />
int IsUnicodeFile(char* szFileName)<br />
{<br />
FILE *fpUnicode;<br />
char l_szCharBuffer[80];<br />
<br />
if((fpUnicode= fopen(szFileName,"r")) == NULL)<br />
return 0;
<br />
if(!feof(fpUnicode))<br />
{<br />
fread(l_szCharBuffer,80,1,fpUnicode);<br />
fclose(fpUnicode);<br />
if(IsTextUnicode(l_szCharBuffer,80,NULL))<br />
{<br />
return 2;
}<br />
else<br />
{<br />
return 1;
}<br />
}<br />
return 0;
}<br />
|
|
|
|
|
sandeepkavade wrote: is there any api to check whether the file contains unicode, utf-8 or ansi characters?
First few bytes of a file determine the nature of a file...
If the first three bytes of a file are EF, BB and BF, the file is a UTF-8 file.
If the first two bytes are FE and FF, the file is a Unicode file.
|
|
|
|
|
hi thomas
i am very new to VC++. it would be really thankful if you could tell me what is this EF, BB and BF. and how to determine them?
Thanx in advance.
|
|
|
|
|
These are hex numbers : 0xEF = 239, 0xBB= 187, ... Simply read these bytes from the file header and compare them to these numbers.
|
|
|
|
|
Nibu babu thomas wrote: First few bytes of a file determine the nature of a file...
If the first three bytes of a file are EF, BB and BF, the file is a UTF-8 file.
If the first two bytes are FE and FF, the file is a Unicode file.
That's not a reliable way to determine whether a file contains Unicode.
UTF-8 is not required to start with a byte-order mark, and files with UTF-16LE and UTF-16BE encodings are actually forbiden to start with it.
|
|
|
|
|
Nemanja Trifunovic wrote: UTF-8 is not required to start with a byte-order mark, and files with UTF-16LE and UTF-16BE encodings are actually forbiden to start with it.
Sorry, why UTF-16(little/big endian) are actually forbidden?
|
|
|
|
|
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like?
Thanks
|
|
|
|
|
Can you please clear out what exactly u want.
Anurag Gandhi.
http://www.softgandhi.co.nr
|
|
|
|
|
I need to know how you will list the files in a directory as the files are added in C++
|
|
|
|
|
Monitor the folder using either ReadDirectoryChangesW() or FindFirstChangeNotification() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What is the best way to list a directory in C++. I've heard of using boost libraries. Any suggestions or comments?
|
|
|
|
|
KirkNarine wrote: What is the best way...
I guess that all depends on your viewpoint (i.e., what's best for you may not be for others, and vice versa).
KirkNarine wrote: I've heard of using boost libraries. Any suggestions or comments?
Technically, C++ has no knowledge of folders and other file-system related things. I'm not familar with Boost so any comments would be unjust. In any case, check out _findfirst() and _findnext() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Any suggestion on listing a directory in C++. I've heard of boost libraries, any comments on it?
|
|
|
|
|
|
Thanks, you've been a huge help. This is just what I needed
|
|
|
|