1. how to compress files
- Posted by sergelli Nov 10, 2013
- 1777 views
what do you guys do to compress files within a program euphoria?
Before I used a copy of gzip.exe, but now it no longer works.
res=system_exec("gzip -c -9 ultmov.txt > ultmov.gz",0)
Any idea?
2. Re: how to compress files
- Posted by jimcbrown (admin) Nov 10, 2013
- 1734 views
what do you guys do to compress files within a program euphoria?
Before I used a copy of gzip.exe, but now it no longer works.
res=system_exec("gzip -c -9 ultmov.txt > ultmov.gz",0)
Any idea?
That should still work. What happens if you manually attempt to run gzip from the command line?
3. Re: how to compress files
- Posted by sergelli Nov 10, 2013
- 1693 views
In command line works well
But inside of a program, as above, res = 1
running my program in. exe, prompt in the last lines that appear are showing an error
ÑÕ]k╝ésu|uFH?Â{ÖpO╗dîf┬╗├5^ù¯ûC:Æû¹Y¡O¥à·ÉÆ>=▒ôî´åà▄╠8#p´Aè¥UäV┴û§ ┼ð╩1w& (╔▓¥·\'z «&gzip: >: Invalid argument gzip: c:\001Stok\00stok\0000Bin\ultmov.gz: No such file or directoryßÀʼÂÄHâq.®╔]{Ë▄PÄüXÄM½ÀÎ
4. Re: how to compress files
- Posted by jimcbrown (admin) Nov 10, 2013
- 1744 views
In command line works well
But inside of a program, as above, res = 1
Hmm.. instead of telling gzip to send the compressed output to stdout and redirecting that into a file, have you tried using the keep option? (Requires gzip 1.6 or later)
Or copying the original file first and then running gzip on the copy?
5. Re: how to compress files
- Posted by sergelli Nov 10, 2013
- 1731 views
My version is deprecated.
gzip -V
gzip 1.3.12
6. Re: how to compress files
- Posted by jimcbrown (admin) Nov 10, 2013
- 1728 views
My version is deprecated.
gzip -V
gzip 1.3.12
I missed that you said gzip.exe earlier. This works fine on a sane OS, but you can't do redirection with system_exec() on Windoze. That never worked.
Copying the original file and then compressing the copy with gzip (without either -c or redirection) should still work with system_exec(). This is probably the easiest method, if you have enough space to make a full sized copy of the original file.
Or you can use system(), and find some other method to determine if gzip was successful or not. (Perhaps an MS-DOS batch script that writes the return code of gzip into a text file.)
Or you can use pipeio and write code to take the output of gzip and place it into a file yourself.
7. Re: how to compress files
- Posted by sergelli Nov 10, 2013
- 1677 views
following your instructions
res=copyFile ("ultmov.txt","c:\\001Stok\\ultmov.txt",1) res=system_exec("gzip -9 c:\\001Stok\\ultmov.txt ",0)
is now working
Thanks jimcbrown