Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compression > #2221 > unrolled thread

Re: using something like fscanf with zlib?

Started byfermut@gmail.com
First post2014-02-13 05:32 -0800
Last post2014-02-14 01:27 +0200
Articles 4 — 4 participants

Back to article view | Back to comp.compression

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: using something like fscanf with zlib? fermut@gmail.com - 2014-02-13 05:32 -0800
    Re: using something like fscanf with zlib? Noob <root@127.0.0.1> - 2014-02-13 15:26 +0100
      Re: using something like fscanf with zlib? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-02-13 18:58 +0000
        Re: using something like fscanf with zlib? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2014-02-14 01:27 +0200

#2221 — Re: using something like fscanf with zlib?

Fromfermut@gmail.com
Date2014-02-13 05:32 -0800
SubjectRe: using something like fscanf with zlib?
Message-ID<7916419a-0a38-4eba-b141-e2f3298df095@googlegroups.com>
On Tuesday, January 26, 1999 6:00:00 AM UTC-2, dre...@yahoo.com wrote:
> I am not an extremely experienced C programmer, but I want to use the
> zlib library to read a text file that I have compressed with gzip.
> The text file has a complicated format in which the lines are not all
> the same length, and I would really like to
> use something like fscanf() to read it. Is this possible with
> zlib? I see a gets() -like routine in the headers, but I dont know
> how to combine this with scanf() to get what i want without losing
> some data.
> 
> thanks for any pointers.
> please email me your replies.
> -david
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

You can use zlib and wrap it to a regular file pointer, this way you can use fscanf,fread,etc. transparently.

FILE *myfopen(const char *path, const char *mode)
{
#ifdef WITH_ZLIB
  gzFile *zfp;

  /* try gzopen */
  zfp = gzopen(path,mode);
  if (zfp == NULL)
    return fopen(path,mode);

  /* open file pointer */
  return funopen(zfp,
                 (int(*)(void*,char*,int))gzread,
                 (int(*)(void*,const char*,int))gzwrite,
                 (fpos_t(*)(void*,fpos_t,int))gzseek,
                 (int(*)(void*))gzclose);
#else
  return fopen(path,mode);
#endif
}

[toc] | [next] | [standalone]


#2222

FromNoob <root@127.0.0.1>
Date2014-02-13 15:26 +0100
Message-ID<ldikk9$s9r$1@dont-email.me>
In reply to#2221
Dearest fermut,

May I draw your attention to the date of the message you are replying to?

> On Tuesday, January 26, 1999 6:00:00 AM UTC-2
>             ^^^^^^^^^^^^^^^^

[toc] | [prev] | [next] | [standalone]


#2223

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2014-02-13 18:58 +0000
Message-ID<ldj4ku$bc7$2@speranza.aioe.org>
In reply to#2222
Noob <root@127.0.0.1> wrote:
> Dearest fermut,
 
> May I draw your attention to the date of the message you are replying to?
 
>> On Tuesday, January 26, 1999 6:00:00 AM UTC-2
>>             ^^^^^^^^^^^^^^^^

I just saw a post in another group at 10:00:00 UTC+3,
and dated Aug. 8th 1996. 

Looks more like the clock is set wrong than an old post to me.

-- glen

[toc] | [prev] | [next] | [standalone]


#2224

FromPhil Carmody <thefatphil_demunged@yahoo.co.uk>
Date2014-02-14 01:27 +0200
Message-ID<87ob2abnkw.fsf@bazspaz.fatphil.org>
In reply to#2223
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:

> Noob <root@127.0.0.1> wrote:
> > Dearest fermut,
>  
> > May I draw your attention to the date of the message you are replying to?
>  
> >> On Tuesday, January 26, 1999 6:00:00 AM UTC-2
> >>             ^^^^^^^^^^^^^^^^
> 
> I just saw a post in another group at 10:00:00 UTC+3,
> and dated Aug. 8th 1996. 
> 
> Looks more like the clock is set wrong than an old post to me.

Does your newsserver still have a copy of 
  <78ljof$m6o$1@nnrp1.dejanews.com>
?

Does your internet even still have a copy of dejanews.com?

Methinks it's a noob reading and posting the total abomination 
that calls itself googlegroups. Google groups sucks, be sure
of that, and this long-dead-thread resurrection is one of its
more minor annoyances.

Google groups sucks.
Phil
-- 
What Alice Hill, President at Slashdot Media, writes:
 Proven track record innovating and improving iconic websites 
 (Slashdot.org, ...) while protecting their voice and brand integrity
What Alice Hill means: 
 2013: Completely fucked up Slashdot, and ignored almost endless
 negative feedback about her unwanted changes. 2014: Killed slashdot.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compression


csiph-web