Windows文件名中的半冒号? [英] semi colons in Windows filenames?

查看:331
本文介绍了Windows文件名中的半冒号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一位用户问为什么我的应用程序不支持文件名中的分号.我逐步执行了代码,似乎Windows函数GetOpenFileName会截断任何包含分号的文件名.例如一个; two.wav"->一个".

One of my users asked why my app does not support semi-colons in filenames. I stepped through my code, seems Windows function GetOpenFileName truncates any filename containing a semi-colon. e.g. "one;two.wav" -> "one".

Microsoft说不允许使用冒号,但不要提及分号...

Microsoft says colons are not allowed, but don't mention semi-colons...

http://msdn.microsoft.com/en -us/library/aa365247(VS.85).aspx

他们合法吗?

..以及如何使GetOpenFileName()与文件名中的分号一起使用?

..and how to GetOpenFileName() to work with semi-colons in filename?

OH !,很奇怪-文件名正确,但左侧滚动"除外.因此,"one; two.wav"看起来就像"two.wav",直到我单击它并按左箭头(然后就可以了).因此,这并不是错误,只是怪异的行为.

OH!, Weird - Filename is correct, except 'scrolled' off to the left. So "one;two.wav" looks like "two.wav" until I click it and press left-arrow (then it's fine). So it's not a bug as such, only weird behaviour.

推荐答案

使用当前代码页中的任何字符作为名称,包括Unicode字符和扩展字符集(128–255)中的字符,但以下各项除外:

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

以下保留字符:

  • < (少于)

(大于)

  • :(冒号)
  • " (双引号)
  • /(正斜杠)
  • \(反斜杠)
  • | (垂直条或管)
  • ? (问号)
  • (星号)
  • 整数值零,有时也称为ASCII NUL字符.
  • 整数表示形式在1到31之间的字符,但允许这些字符的替代流除外.
  • 目标文件系统不允许的其他任何字符.
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • (asterisk)
  • Integer value zero, sometimes referred to as the ASCII NUL character.
  • Characters whose integer representations are in the range from 1 through 31, except for alternate streams where these characters are allowed.
  • Any other character that the target file system does not allow.
  • 我能够在Win7系统上的文件名中添加分号.注意代码,可能是您的代码或第三方代码,它们用意外的字符(最显着的空格)来做奇怪的事情.

    I'm able to add semicolons to filenames on my Win7 system. Watch for code, probably yours or third-party code, that does strange things with unexpected characters (most notably spaces).

    这篇关于Windows文件名中的半冒号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆