⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 binary_iostreams_kanze.txt

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 TXT
字号:
From: James Kanze <kanze@gabi-soft.de>Newsgroups: comp.lang.c++.moderatedSubject: Re: binary iostreams ?Date: 3 Feb 2001 14:28:19 -0500Message-ID: <86lmro86qp.fsf@alex.gabi-soft.de>"Plinio Conti" <plinio.contiNO@SPAMMINGmclink.it> writes:|>  Why std c++ library stream classes are only text-oriented?Because that is the only universally recognized format.|>  I mean, if I want to write an int, a float, etc. AS IT IS I can't|>  use streams, because they write and read a human readable text|>  format of numbers.Correct.|>  Does anyone know how to solve the problem?It depends on what you really want to do.  If you are just dumping ablock of memory to disk, in order to free up memory, and will reread itlater in the same run of the same program, ostream::write andistream::read are what you need.  Note, however, that this ony works 1)in the same run of the same program, and 2) for PODs without pointers.If you are writing something that will be read by another program, or alater run of the same program, you'll have to define a specific formatto use, and implement streams to input and output that.  If you arewriting something that will be read by an existing program, or betransmitted over a network to another machine, you will have to find outwhat protocol is expected, and adher to it.|>  Any public library?Not that I know of.  I think that there is a library somewhere thatoutputs in format RPC, or maybe some Internet format.|>  What do you think about this choice?What other choice is possible?  It's not reasonable to ask the standardto support all binary formats, and it's not reasonable for it to favorany one of them.  Given that, what else can you do.--James Kanze                               mailto:kanze@gabi-soft.deConseils en informatique orient閑 objet/                   Beratung in objektorientierter DatenverarbeitungZiegelh黷tenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -