473,663 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to turn a stream to a binary file

as subject, what's the normal way to implement? the stream is binary as it
may be come from word, images or other objects?


Nov 15 '05 #1
2 1224
Mullin Yu <mu*******@ctil .com> wrote:
as subject, what's the normal way to implement? the stream is binary as it
may be come from word, images or other objects?


What do you mean by "turn a stream"? Is this a stream that you're
reading from somewhere else? If so, just create a FileStream to write
to, and iterate, reading a chunk from the incoming stream and writing
it to the FileStream, repeating until you've reached the end of the
incoming stream.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Mullin, have you gotten a chance to look at the BinaryWriter class? That
will do what you want. Here's a sample straight from MSDN.

http://msdn.microsoft.com/library/de...asp?frame=true

--
Greg Ewing [MVP]
http://www.citidc.com

"Mullin Yu" <mu*******@ctil .com> wrote in message
news:#o******** ******@TK2MSFTN GP12.phx.gbl...
as subject, what's the normal way to implement? the stream is binary as it
may be come from word, images or other objects?

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2980
by: Moritz Tacke | last post by:
Hi there! I have a problem concerning the file input to a c++ program: the expected input is either in binary or in some kind of text format; what I finally want is the binary version. I know how to translate between these two versions and would like to write some kind of wrapper. This wrapper should open the text file and provide an istream which behaves exactly like the ifstream of an equivalent binary file would. Is there a smart way...
8
3879
by: Roberto Rocco | last post by:
Hello, I have a struct and want to stream it to a file (binary). I cannot use because this is not supported under the Compact Framework. What is the best approach to use? Another question in this aspect: How to I retrieve the size of my stuct? SizeOf seems not to work on structs? Many thanks in advance, Roberto.
0
1620
by: JackRazz | last post by:
I'm trying to serialize a collection to a file stream by serializing each object individually. The code below works fine with the BinaryFormatter, but the SoapFormatter reads the first object and just goes to the end of the file. After reading the first object, the fStream.Position is pointed to the end of the file. The collection serializes/deserilizes fine when I just serialize the hashtable vs. each object in the hashtable. Does...
2
1755
by: Michael Kolias | last post by:
Hello everyone and happy holidays! I have a situation where I want to parse on the fly a stream of binary data. I am developing an httpmodule for asp.net for file uploading. I do not whant to use the built-in control because it's inadequate. In theory I would use a que and feed data as it comes in and then have a parser that extracts the data from the que, parse them and do whatever.
1
2908
by: Pedro Leite | last post by:
hello. got stalled at at point that i can no longer get my thoughts together. the point, is in classic asp, stream an excel file from a firebird database. temporarly save it if necessary stream it to the browser delete the temp file on googling, i found some examples but all assuming that the file is locally
4
6718
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my code ?? thank you Pedro Leite From Portugal ------------------------------------
5
2662
by: Hardy Wang | last post by:
Hi all, I am new to WSE 3.0, and currently reading the document shipped with installation. From sample provided (see below), I created WSE service side code, but how can I consume stream returned by web method in my Web Form application? I already configurated web.config of my web service by running WSE 3.0 setting tool. Thanks!
1
3846
by: Alexander Korsunsky | last post by:
Hi! Is it possible to extract the mode flags of a stream (FILE* stream or fstream - object), without looking at how the stream was opened? What I mean by mode flags is wether the stream is opened in read only mode, write only, binary and so on. I did not find any functions in C, but I found something similar in C++, the flags() member functio of an fstream object. I've tried to check the flags on ios_base::binary ios_base::in binary...
20
9410
by: tomPee | last post by:
Hi, I've bumbed into a slight problem now, and I just don't seem to know how to fix it. What I want to do is the following: Send over a socket: 1. Number of files to be send (not as an integer, just as a string) then for each file to be send: 2. Length of Filename (again as a string) 3. Filename 4. File as binary data.
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.