"\\.\ F:"代表什么意思是? [英] What does "\\.\F:" mean?

查看:308
本文介绍了"\\.\ F:"代表什么意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了一些代码弹出CD ROM驱动器,并且其中一个功能是 CreateFile ,它的第一个参数是 filename .起初,我只传入了"F:" (我的CD ROM驱动器号),并且出现了错误代码21(设备未准备好)的错误,我重新检查了示例代码,我应该"已传入@ "\\.\ F:" ,那么字符串"\\.\ F:" 是什么?

您的帮助将不胜感激!谢谢!

Hi, I have tried some code ejecting CD ROM drive and one of the functions is CreateFile, the first argument of it is filename. At first I passed in "F:" (my cd rom drive letter) only, and there was an error with error code of 21 (device is not ready), I rechecked the sample code and I should''ve passed in @"\\.\F:" so what is the string "\\.\F:"?

Your help would be highly appreciated! Thanks!

推荐答案

我不确定您可以使用CreateFile写入CD-ROM(人们仍在使用那些CD-ROM吗?).但是"\\.\ F:"没有任何意义. "\\."将是当前驱动器的根,可能是"C:\",而"F:"将指向您的F驱动器,但是将它们放在一起是行不通的(您将转到C:\ F: \,这无效).

更不用说第一个"\"被转义,第二个没有被转义,因此根据字符串是否使用@(即@"\\.\ F:"),您也可以转到C:\ \ F :(一个无名目录,据我所知Windows不允许,然后是一个无效的驱动器),或者F是控制字符(我认为是换页符),在Windows路径中也应无效.

综上所述,它没有任何意义.

另一方面,由于使用了CreateFile,然后为它提供了驱动器的路径,因此可能会弹出错误提示.您需要为其提供文件路径,例如"F:\\ myfile.ext".
I''m not sure you can use CreateFile to write to a CD-ROM (people are still using those?). But "\\.\F:" doesn''t make sense. "\\." would be the root of the current drive, probably "C:\", and "F:" would point to your F drive, but putting them together doesn''t work (you''d be going to C:\F:\, which is invalid).

Not to mention the first "\" is escaped, and the second is not, so depending on whether the string is using an @ or not (i.e. @"\\.\F:") you could also be going to C:\\F: (a nameless directory, not allowed by Windows to my knowledge, then a drive inside that which is invalid), or the F is a control character (form feed I think?) which should be invalid in Windows paths as well.

So to summarize, it doesn''t mean anything.

On the other hand, your error is probably popping up because you use CreateFile, and then give it a path to a drive. You need to give it a path to a file, e.g. "F:\\myfile.ext".


CreateFile除了创建和打开文件外,还有很多用途.传递诸如"\\.\ F:"之类的字符串会打开逻辑驱动器,以便可以使用DeviceIO功能.

请参见 http://msdn.microsoft.com/zh-我们/library/windows/desktop/aa363858(v=vs.85).aspx [
CreateFile has many uses beyond creating and opening files. Passing a string such as "\\.\F:" opens a logical drive so that DeviceIO functions can be used.

See http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx[^]

Alan.


这篇关于"\\.\ F:"代表什么意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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