English 中文(简体)
确定文件是二进制文件还是文本
原标题:Determine if file is binary or text

是否有方法可以确定文件是二进制还是文本文件, 使用 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364229%28v=vs. 85%29.aspx" rel=“nofollow” >File 管理函数 或 MFC?

在 < a href=> http://msdn.microft.com/en-us/library/windows/desktop/aa364229%28v=vs.85%29.aspx" rel=“nofollow” >File 管理功能 中, GetFileType似乎没有区分二进制文件和文本文件。与 dwFileAtribites 属性CFile:Getstatus () ,但 m_attritte没有说明文件是二进制还是文本。

有没有人知道用这两个图书馆之一 做这件事的方法?

(我想知道是因为我试图让一个函数通过一个目录递归。 我重写文本文件( 使用 CStdioFile ), 并在这里和那里替换一些单词... 但它似乎破坏了目录中的任何图像。 我希望也能复制这些图像... 但我需要一种方法来区分二进制和文本文件, 这样我就可以用不同的方式对待它们 。 )

最佳回答

据我所知,没有简单的API可以这样做,无论是MFC还是其他方式。 然而,在这些类似的问题上有很多有用的想法:

< a href=" "https://stackoverflow.com/ questions/567757/how-do-i-distinguish- between-binary-and-text-files" "我如何区分二进制文件和文本文件?

< a href=" "https://stackoverflow.com/ questions/277521/ how-to-identify-the-file-content-is- ascii- or- binary" > 如何将文件内容识别为 ASCII 或二进制

问题回答

暂无回答




相关问题
Problem statically linking MFC libraries

I have a Visual Studio 6 workspace I m trying to convert to a Visual Studio 2008 solution. The output of said solution is a .dll. It has to be a .dll and it needs to statically link MFC as I can t ...

Switching to WPF. Is it time?

I m considering switching from MFC to WPF. My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration ...

Crash within CString

I am observing a crash within my application and the call stack shows below mfc42u!CString::AllocBeforeWrite+5 mfc42u!CString::operator=+22 No idea why this occuring. This does not occur ...

C# for UI, c++ for library

I have a numerical library coded in C++. I am going to make a UI for the library. I know some MFC. So one solution is to use MFC and make a native application. The alternative is C#. I know nothing ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

MFC List Control

In MFC, I can edit the text of items in the list control but only for the first column by setting the Edit Labels to true. Now when I click the first column item to change its text, I m able to change ...

热门标签