C ++中的文件打开模式 [英] File opening modes in C++

查看:79
本文介绍了C ++中的文件打开模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在二进制模式下使用C ++中的open()函数打开.xls或.PDF文件吗?如果没有,我该如何构建一个应用程序,以读取具有这种文件格式(甚至更多)的文件内容

Can I open a .xls or .PDF file using the open() function in C++ with binary mode and read its contents? If not, how can I build an application program that can read the contents of files with such file formats (and maybe more)

推荐答案

是的,您可以将文件系统中的任何文件作为二进制文件打开,也可以读取(只要您的操作系统允许基于文件访问权限打开文件,并且没有其他应用程序被锁定)等等)。

Yes, you can open any file in your filesystem as a binary file, and you can read it too (as long as your operating system allows the file to be opened based on file access rights, and no other application has got a lock on it, etc).

接下来,您可能会问如何解释PDF或XLS文件?正如他们在英格兰所说的那样,那是另外一锅鱼。 PDF和XLS文件都不是直接理解的。我最近查看的PDF librar包含几十个文件,并且源代码为几兆字节。我使用Python处理XLS文件,并且其中的代码有几千行。

Next you'll probably ask "How do I interpret a PDF or XLS file?" and that's a whole other kettle of fish as they say here in England. Neither PDF, nor XLS files are straight forward to "understand". A PDF librar that I looked at recently contains several dozen files, and is several megabytes of source code. I've worked with XLS files in Python, and the code there was a few thousand lines of code.

这篇关于C ++中的文件打开模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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