是否有可能创建一个没有EOF标记的文件? [英] Is it possible to create a file with no EOF marker?

查看:202
本文介绍了是否有可能创建一个没有EOF标记的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序读入一个平面文件并解析出数据。此文件不包含用于执行校验和的标题信息或总数据。所以我想创建测试用例来确保我们的应用程序正确处理不完整的文件。



有没有办法创建一个没有EOF标记的平面文件?也许我可以使用一个工具,从现有的文本文件中删除EOF标记?

解决方案

平面文件不包含结束。

几乎所有的现代文件系统都是基于流的,只是一堆磁盘上的字节,它们没有记录/文件标记。

读取文件的std库添加了任何文件结束信号

您应该测试它是否正确处理不完整的行(即3个值而不是4个)和缺少/不同的行结束(CR或LF,而不是CR / LF)

We have an application that reads in a flat file and parses out the data. This file contains no header information or total data with which to do a checksum. So I would like to create test cases to make sure our application properly handles "incomplete" files.

Is there a way to create a flat file with no EOF marker? Perhaps a tool that I can use to remove the EOF marker from an existing text file?

解决方案

Flat files do not contain an end of file marker.

Almost all modern filesystems are stream based, just a bunch of bytes on disk, they don't have record/file markers.
Any end-of-file signal is added by the std library reading the file

You should test that it deals properly with incomplete lines (ie 3 values rather than 4) and missing/differnet end of lines (CR or LF rather than CR/LF)

这篇关于是否有可能创建一个没有EOF标记的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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