Re: _stprintf
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 08 Aug 2006 23:58:20 -0400
Some versions of Windows implement DBCS, apparently the Japanese version of Windows had
this support, but it is not documented as far as I can tell.
joe
On Tue, 8 Aug 2006 12:57:43 +0900, "Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote:
I think my reply got lost or maybe accidentally sent personally to Dr.Joseph M. Newcomer [MVP]
Newcomer, sorry.
"Since you can't use any multibyte encoding in CreateFile,"
I am astounded to see that assertion.
CreateFile has created Japanese filenames since Windows 95 and NT 3.1
(though not in some foreign versions of those operating systems).
OpenFile created Japanese filenames in Windows 3.1, MS-DOS, etc. (though not
in some foreign versions of those operating systems).
On FAT12, FAT16, and NTFS.
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:nnidd2dckt42edmn498eemd3idlg53cpjb@xxxxxxxxxx
But the limit is MAX_PATH characters. THat's what we've been discussing.
In Unicode
mode, the limit is MAX_PATH characters, which would occupy 2*MAX_PATH
bytes. That is,
MAX_PATH TCHARs, and therefore their comment is completely CONSISTENT with
the fact that a
'character' is a 'TCHAR'. Since you can't use any multibyte encoding in
CreateFile, I
don't see where there is any problem here. 'character', in nearly every
context we've
discussed, means 'TCHAR'.
This also means that if you are using Unicode to represent Kanji, then you
should be able
to use MAX_PATH Kanji characters to name a file.
joe
On Thu, 3 Aug 2006 17:13:52 +0900, "Norman Diamond"
<ndiamond@xxxxxxxxxxxxxxxx> wrote:
"Mihai N." <nmihai_year_2000@xxxxxxxxx> wrote in messageJoseph M. Newcomer [MVP]
news:Xns9813EB11E9700MihaiN@xxxxxxxxxxxxxxxx
The one for which Microsoft sent personal e-mail was CreateFile.
Microsoft assured me that even the ANSI version (CreateFileA) uses
Unicode internally and MAX_PATH is the limit on the number of
characters
internally, so if an ANSI application needs more than MAX_PATH bytes to
specify a usable filename then it can indeed do so. I've been a bit
negligent in not writing a test program to test this answer yet.
But CreateFile does not take a number of chars as parameter.
So what? Where we intuitively think that the stated limit of MAX_PATH
characters means MAX_PATH chars in ANSI, Microsoft informed me that the
limit really is MAX_PATH characters even if it takes twice that many
bytes.
You asked for examples of cases where we had been wrong in nearly always
assuming that MSDN's statements about characters meant TCHARs, and this is
a
big example.
What I suspect is happening is that the MAX_PATH is the limit if you
don't
use "\\?\" and is there both in the W and A versions.
And since the A version does a conversion to Unicode and calls the W
one,
the limit is probably there and expressed in utf16 code units, indeed.
You suspect that Microsoft's e-mail to me was accurate, and as mentioned,
I
have the same impression. Though they send a lot of unbelievable e-mails,
they send some believable e-mails too and this was one.
Interesting for some week-end experiments :-)
Yup. By the way, considering that VFAT can store a filename consisting of
around 250 Kanji, one weekend experiment would be to try opening the file
under Windows 98 (Japanese version of course). But really I'll consider
it
close enough if it works under Windows 2000, XP, 2003, and Vista beta. I
haven't had time to test it and I do believe that mail.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: _stprintf
- From: Mihai N.
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- References:
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- From: Joseph M . Newcomer
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- From: Mihai N.
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- Prev by Date: Re: MDI focus problem
- Next by Date: Re: _stprintf
- Previous by thread: Re: _stprintf
- Next by thread: Re: _stprintf
- Index(es):
Relevant Pages
|