PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > How to write binary data to a file using buffer?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to write binary data to a file using buffer?

Réponse
 
LinkBack Outils de la discussion
Vieux 06/06/2008, 04h38   #1
Lambda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to write binary data to a file using buffer?

I'd like to write compressed data to a file.
To improve performance, I want to use buffer.

I read some books, they all talk about 'character' stream.
But I think compressed data should be binary.

And, what buffer size if optimal?
How can I set the buffer size?

I need to checkpoint the buffer when
1) the buffer is full.
2) I have put all the data to the buffer.

Should I use standard library or boost?

  Réponse avec citation
Vieux 06/06/2008, 08h56   #2
Michael DOUBEZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to write binary data to a file using buffer?

Lambda a écrit :
> I'd like to write compressed data to a file.
> To improve performance, I want to use buffer.
>
> [snip]
> And, what buffer size if optimal?


That depends on your architecture, the algorithm you use ...

> How can I set the buffer size?


You cannot but you can set the buffer to use with a call to
streambuf::pubsetbuf().

> I need to checkpoint the buffer when
> 1) the buffer is full.


You can overload streambuf:verflow()

> 2) I have put all the data to the buffer.


I don't think you can know that but perhaps at flush() time.

> Should I use standard library or boost?


Boost.IOstream already provides compression and decompression in the
zlib, gzip and bzip2 formats. It would save you time. Using their
generic stream implementation might be a good idea; I don't know.

For more information about streambuf, see:
http://www.cplusplus.com/reference/iostream/streambuf/

--
Michael
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h33.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12053 seconds with 10 queries