getfilename如何在c ++中工作 [英] How getfilename works in c++

查看:197
本文介绍了getfilename如何在c ++中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道getfilename是如何工作的。



如果我将image.jpeg作为getfilename的输入,我应该期待什么作为输出。



这个方法会以二进制模式打开文件吗?



如果我提供的文件名没有扩展名我应该期待什么输出。



任何人都可以建议任何文章或解释吗?



有任何读取给定文件的文件类型的方法?? /

I want to know how getfilename works.

If I give "image.jpeg" as the input for getfilename what should I expect as output.

Will this method open the file in binary mode?

If I give a file name without extension what output should I expect.

Can anyone suggest any article or explanation of this?

is there any method to read the file-type of a given file??/

推荐答案

因为你用 MFC标记了你的问题,我假设你问的是 CFile :: GetFileName [ ^ 。这种方法,如文档所述,返回与 CFile 对象关联的文件的名称。



<小> [更新]

GetFileName 不提供您需要的信息。您可以使用文件的扩展名来猜测其类型或(在jpeg情况下)检查文件标题中的幻数(请参阅C#如何测试文件是jpeg? [ ^ ] Stack Overflow

[/ Update]
Since you tagged your question (also) with MFC, I am assuming you are asking about CFile::GetFileName[^]. Such method, as the documentation states, returns the name of the file associated to the CFile object.

[Update]
GetFileName does NOT provide the info you are requiring. You may use the extension of the file for guessing its type or (in jpeg case) check the magic number in the header of the file (see "C# How can I test a file is a jpeg?"[^] at Stack Overflow.
[/Update]


看在文档。它明确指出此函数返回名称作为一个字符串的文件。就是这样,文件类型没什么区别。
Look at the documentation. It clearly states that this function returns the name of the file as a string. That is all it does, and it makes no difference what the file type is.


这篇关于getfilename如何在c ++中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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