如何在fortran77中解压文件?

发布于 2024-07-16 03:35:39 字数 236 浏览 8 评论 0原文

我有一个压缩文件。 让我们忽略 tar 命令,因为我不确定它是用它压缩的。 我所知道的是它是在 fortran77 中压缩的,这就是我应该用来解压缩它的东西。 我该怎么做? 解压是单向的还是我需要某个头文件来引导(直接)解压?

它不是 .Z 文件。 它以别的东西结束。 我需要什么来解压它? 我知道最终解压存档的格式。

该文件是否有可能通过简单的方式压缩,但它显示为不同的扩展名?

I have a compressed file.
Let's ignore the tar command because I'm not sure it is compressed with that.
All I know is that it is compressed in fortran77 and that is what I should use to decompress it.
How can I do it?
Is decompression a one way road or do I need a certain header file that will lead (direct) the decompression?

It's not a .Z file. It ends at something else.
What do I need to decompress it? I know the format of the final decompressed archive.

Is it possible that the file is compressed thru a simple way but it appears with a different extension?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

仙女山的月亮 2024-07-23 03:35:39

首先,让我们从等式中去掉“fortran”部分。 没有标准(我指的是 Fortran 标准)方法来压缩或解压缩文件,因为 Fortran 没有压缩实用程序作为语言的一部分。 也许有人自己写了一些,但这完全取决于他。

因此,您只能使用公开可用的压缩实用程序等。 在有这些可用的系统上,以及支持它的编译器上(它有所不同),您可以使用 SYSTEM 函数,它通过将命令字符串传递给操作系统的命令解释器来执行系统命令(我知道它存在于 cvf 中,可能ivf ...您可能应该在编译器的帮助下查找它)。

由于您已经提出了类似的问题已经< /a> 我想你仍然有这个问题。 您提到“它是用 fortran77 压缩的”。 你是什​​么意思 ? 有人在 f77 中构建了一个压缩实用程序并使用了它? 那么这将使其成为一个定制解决方案?

如果它是某种自定义解决方案,那么它实际上可以是任何东西,因为许多算法可以用作“压缩算法”(与纯文本相比,将文件写入二进制文件将节省几个字节;瞧,“压缩”)

或者我是不是误会了什么? 请详细说明一下。

First, let's get the "fortran" part out of the equation. There is no standard (and by that, I mean the fortran standard) way to either compress or decompress files, since fortran doesn't have a compression utility as part of the language. Maybe someone written some of their own, but that's entirely up to him.

So, you're stuck with publicly available compression utilities, and such. On systems which have those available, and on compilers which support it (it varies), you can use the SYSTEM function, which executes the system command by passing a command string to the operating system's command interpreter (I know it exists in cvf, probably ivf ... you should probably look it up in help of your compiler).

Since you asked a similar question already I assume you're still having problem with this. You mentioned that "it was compressed with fortran77". What do you mean by that ? That someone builded a compression utility in f77 and used it ? So that would make it a custom solution ?

If it's some kind of a custom solution, then it can practically be anything, since a lot of algorithms can serve as "compression algorithms" (writing file as binary compared to plain text will save a few bytes; voila, "compression")

Or have I misunderstood something ? Please, elaborate this a little.

过度放纵 2024-07-23 03:35:39

我的猜测是您有一个二进制文件,它是由 Fortran 程序输出的。 这些文件可能看起来像压缩文件,因为它们在文本编辑器中无法读取。

Fortran 允许您将内存中的数据写入文件而不对其进行格式化,以便您可以稍后重新加载它而无需解析它。 然而,问题是您需要原始源代码才能查看文件中写入了哪些类型的变量。

如果您无法访问 Fortran 源代码,但有很多空闲时间,您可以编写一些简单的 Fortran 程序并猜测正在使用什么类型的变量。 不过,我不建议这样做,因为 Fortran 不太宽容。

如果您想要尝试一些简单的源代码,请查看 此页面详细介绍了 Fortran 中的二进制读写,并包含一个代码示例。 首先将 reclength=reclength*4 替换为 reclength=reclength*2 以获得双精度实数。

My guess is that you have a binary file, which is output by a Fortran program. These can look like compressed files because they are not readable in a text editor.

Fortran allows you to write the in-memory data out to a file without formatting it, so that you can reload it later without having to parse it. The problem, however, is that you need that original source code in order to see what types of variables are written in the file.

If you have no access to the fortran source code, but a lot of time to spare, you could write some simple fortran program and guess what types of variables are being used. I wouldn't advise it, though, as Fortran is not very forgiving.

If you want some simple source code to try, look at this page which details binary read and write in Fortran, and includes a code sample. Just start by replacing reclength=reclength*4 with reclength=reclength*2 for a double precision real.

人心善变 2024-07-23 03:35:39

没有标准的减压方法,有很多。 您需要知道用于压缩它的方法才能解压缩它。

There is no standard decompression method, there are tons. You will need to know the method used to compress it in order to decompress it.

等风来 2024-07-23 03:35:39

你说文件扩展名不是.Z,而是别的东西。 那是什么别的东西?

如果是 .gz(这在 Unix 系统上很常见),则“gunzip”是正确的命令。 如果是 .tgz,您可以将其压缩并解压。 (或者您可以阅读 tar(1) 的手册页,因为它可能能够同时进行压缩和解压。)

如果是在 Windows 上,请查看 Windows 是否可以直接读取它,因为文件系统本身似乎支持 ZIP格式。

如果有其他情况,请仅列出文件名(或者,如果存在安全隐患,请列出以第一个句点开头的文件名),我们也许能够弄清楚。

You said that the file extension was not .Z, but something else. What was that something else?

If it's .gz (which is very common on Unix systems), "gunzip" is the proper command. If it's .tgz, you can gunzip and untar it. (Or you can read the man page for tar(1), since it probably has the ability to gunzip and extract together.)

If it's on Windows, see if Windows can read it directly, as the file system itself appears to support the ZIP format.

If something else, please just list the file name (or, if there are security implications, the file name beginning with the first period), and we might be able to figure it out.

昵称有卵用 2024-07-23 03:35:39

您可以使用 file 命令检查它是否是已知的压缩文件类型。 假设 file 返回类似“二进制文件”的内容,那么您几乎肯定会看到纯二进制数据。

You can check to see if it's a known compressed file type with the file command. Assuming file returns something like "binary file" then you're almost certainly looking at plain binary data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文