Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outputting to DRAM instead of a file while using gzip/gunzip

1 view
Skip to first unread message

Kuhl

unread,
Nov 6, 2009, 9:39:43 AM11/6/09
to
I am a Linux user. I wish to generate the gzip or gunzip result of a
file into the DRAM space instead of a file, because I want it to run
even in a directory that I have no write permission, and I don't want
to change the file even if I have write permission.

Although it's doable to achieve this goal by writing C code while
making use of gzip/gunzip C source code downloaded somewhere, this
approach needs too much effort. If there's an approach of using gzip/
gunzip of my operation system, but directing the output to a DRAM
space instead of a file, and still allows my further program to access
the virtual file in DRAM, then this is what I prefer. What's more, if
I get the way to do this, then this technique will be applicable not
only to gzip/gunzip, but also to many other shell commands.

Is there such kind of solution?
Many thanks.

jellybean stonerfish

unread,
Nov 6, 2009, 10:20:43 AM11/6/09
to
On Fri, 06 Nov 2009 06:39:43 -0800, Kuhl wrote:

> I am a Linux user. I wish to generate the gzip or gunzip result of a
> file into the DRAM space instead of a file, because I want it to run
> even in a directory that I have no write permission, and I don't want to
> change the file even if I have write permission.

You can extract the file to another location without removing or
changing the original file.

gunzip -c smallfile.gz > /tmp/bigfile

From the gzip man page:

-c --stdout --to-stdout
Write output on standard output; keep original files unchanged.
If there are several input files, the output consists of a
sequence of independently compressed members. To obtain better
compression, concatenate all input files before compressing them.

Eric Sosman

unread,
Nov 6, 2009, 11:32:01 AM11/6/09
to

You could also use -c without any explicit redirection,
launch the command with a popen() call in your program, and
read the command's standard output from the pipe.

--
Eric Sosman
eso...@ieee-dot-org.invalid

0 new messages