Click here to Skip to main content
16,011,685 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralIXMLDOMDocument::loadXML() Pin
Rickard Andersson201-Jan-03 6:36
Rickard Andersson201-Jan-03 6:36 
GeneralRe: IXMLDOMDocument::loadXML() Pin
Michael Dunn1-Jan-03 6:39
sitebuilderMichael Dunn1-Jan-03 6:39 
GeneralCommand Id range Pin
User 98851-Jan-03 6:24
User 98851-Jan-03 6:24 
GeneralRe: Command Id range Pin
Pavel Klocek1-Jan-03 8:37
Pavel Klocek1-Jan-03 8:37 
GeneralMemory consumption Pin
Shah Shehpori1-Jan-03 5:42
sussShah Shehpori1-Jan-03 5:42 
GeneralRe: Memory consumption Pin
Florin Ochiana1-Jan-03 11:48
Florin Ochiana1-Jan-03 11:48 
GeneralRe: Memory consumption Pin
Mike Nordell1-Jan-03 18:56
Mike Nordell1-Jan-03 18:56 
QuestionUnicode comparing of file extensions? Pin
Fahr1-Jan-03 3:55
Fahr1-Jan-03 3:55 
Hello,

I ran into the following problem in my Unicode project. I have a FileName of the type unsigned short* and I'm willing to extract the extension and compare it. I use the following code:

==
unsigned short* FileExt = new unsigned short[10];
int FileNameLen = wcslen(FileName);
for(int x = FileNameLen; x >= 0; x--)
{
if(FileName[x] == '.')
{
// Get the extension
wcsncpy(FileExt, FileName + x + 1, FileNameLen - x - 1);
break;
}
}

FileExt = _wcsupr(FileExt);

if(FileExt == _T("U") || FileExt == _T("DLL"))
{
return 1;
}
else if(FileExt == _T("UNR"))
{
return 2;
}
else
{
return 3;
}
===

First of all, it ALWAYS returns 3, none of the other IFs are triggered for some reason.
Second, if I view the FileExt after the extraction; if the extension of the file is only ONE charachter, it adds a strange other char to it for no apparent reason...

Can anyone tell me what I'm doing wrong?

Thanks,
- Fahr
AnswerRe: Unicode comparing of file extensions? Pin
Gary R. Wheeler1-Jan-03 4:42
Gary R. Wheeler1-Jan-03 4:42 
GeneralRe: Unicode comparing of file extensions? Pin
Fahr1-Jan-03 5:05
Fahr1-Jan-03 5:05 
AnswerRe: Unicode comparing of file extensions? Pin
Michael Dunn1-Jan-03 6:36
sitebuilderMichael Dunn1-Jan-03 6:36 
GeneralRe: Unicode comparing of file extensions? Pin
Fahr1-Jan-03 6:56
Fahr1-Jan-03 6:56 
GeneralRe: Unicode comparing of file extensions? Pin
Michael Dunn1-Jan-03 7:26
sitebuilderMichael Dunn1-Jan-03 7:26 
GeneralRe: Unicode comparing of file extensions? Pin
Fahr1-Jan-03 8:39
Fahr1-Jan-03 8:39 
GeneralRe: Unicode comparing of file extensions? Pin
Michael Dunn1-Jan-03 8:54
sitebuilderMichael Dunn1-Jan-03 8:54 
GeneralRe: Unicode comparing of file extensions? Pin
Fahr1-Jan-03 9:23
Fahr1-Jan-03 9:23 
GeneralRe: Unicode comparing of file extensions? Pin
Michael Dunn1-Jan-03 9:44
sitebuilderMichael Dunn1-Jan-03 9:44 
GeneralRe: Unicode comparing of file extensions? Pin
Fahr1-Jan-03 9:49
Fahr1-Jan-03 9:49 
QuestionHow to find the Network speed (without PDH)? Pin
adara1-Jan-03 3:48
adara1-Jan-03 3:48 
AnswerRe: How to find the Network speed (without PDH)? Pin
Mike Nordell1-Jan-03 19:01
Mike Nordell1-Jan-03 19:01 
Generalexecute program from memory Pin
ncm1-Jan-03 3:25
ncm1-Jan-03 3:25 
GeneralRe: execute program from memory Pin
Mike Nordell1-Jan-03 19:03
Mike Nordell1-Jan-03 19:03 
GeneralRe: execute program from memory Pin
ncm2-Jan-03 1:06
ncm2-Jan-03 1:06 
GeneralProblem with resource id's... [Visual C++.NET] Pin
rkpk1-Jan-03 2:11
rkpk1-Jan-03 2:11 
GeneralCHtmlView Pin
alex.barylski1-Jan-03 1:07
alex.barylski1-Jan-03 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.