创建新文件类型
我被分配一个项目来创建一个新的二进制文件结构,用于存储来自 3d CAD/CAM 软件的坐标信息。如果您能指出一些有关创建新的二进制文件格式的文章或书籍,我将不胜感激。感谢您的宝贵时间:)
I am assigned a project to create a new binary file structure for storing co-ordinate information coming out of a 3d CAD/CAM software. I would highly appreciate if you kindly point out some articles or books regarding creation of new binary file format. Thanks for your time :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我首先会在 wotsit.org 上查看其他类似的文件格式。该站点适用于各种不同的文件格式,并且包含其规范的链接。
通过查看其他文件格式,您将了解如何最好地格式化和呈现有关您的规范的信息。
I would start by taking a look at other similar file formats on wotsit.org. The site is for various different file formats and it contains links to their specifications.
By looking at other file formats you'll get ideas about how best to format and present information about your specification.
有一种通用的二进制(紧凑)表示法,称为 ASN.1。它被广泛使用并且有关于它的书籍。 ASN.1 可以与 XML 进行比较,但级别比 XML 低(更原始但更灵活)。而XML,尤其是上面提到的二进制XML,也会对你有很大的帮助。
另外,如果您的文件中要保存多个数据序列,请查看实体文件系统 作为一个文件中多个数据流的容器。
There's a universal binary (and compact) notation called ASN.1. It's used widely and there are books about it available. ASN.1 can be compared to XML, but on some lower (more primitive yet more flexible) level than XML. And XML, especially binary XML mentioned above, would be of great help to you too.
Also, if you have more than just one sequence of data to hold in your file, take a look at Solid File System as a container for several data streams in one file.
如果我有相同的任务,我会检查已经存在的东西,例如 .OBJ 然后尝试实现类似的东西,可能需要进行一些小的更改。
If I had the same assignment, I would inspect something already existing, like .OBJ and then try to implement something similiar, probably with minor changes.
简短的回答:不要。使用 XML 或文本格式来提高可读性、可扩展性和可移植性。
更长的答案:CAD/CAM 有大量“传统”格式。我希望使用其中之一(如果需要的话可能会扩展它)。如果没有合适的东西,并且 XML 被认为臃肿且缓慢,请查看 二进制 XML 格式反而。
Short answer: Don't. Use XML or a text format instead for readability, extensability amd portability.
Longer answer: CAD/CAM has loads of 'legacy' formats around. I'd look to use one of those (possibly extending it if necessary). And if there's nothing suitable, and XML is considered to bloaty and slow, look at Binary XML formats instead.
我认为你真正需要的是弄清楚你必须保存哪些数据。然后将其加载到内存中并序列化该内存
这是一个关于 C++ 中的 序列化的教程。此页面还解决了保存数据的许多问题
I think that what you really need is to figure out what data you have to save. Then you load it into memory and serialize that memory
Here is a tutorial on serialization in C++. This page also addresses many issues with saving data