473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Dumb Question

How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all of
it in a stream.

Thanks for any help,

Bob
Feb 28 '07 #1
3 1749


"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all of
it in a stream.

Thanks for any help,

Bob

Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran
Mar 1 '07 #2
Thanks
"Mythran" <ki********@hotmail.comwrote in message
news:E3**********************************@microsof t.com...
>

"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
>How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all
of it in a stream.

Thanks for any help,

Bob


Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran


Mar 1 '07 #3
Mythran wrote:
>

"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
>How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read
all of it in a stream.

Thanks for any help,

Bob


Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran

You ignore the return value of the call to the Read method. That means
that the entire file might not have been read, but you will silently
ignore that.

Get the return value of the call to see how much of the array that has
been filled, and loop until you have gotten the entire file.

If you are using framework 2.0+, you can instead use File.ReadAllBytes
to read the entire file.

--
Göran Andersson
_____
http://www.guffa.com
Mar 1 '07 #4

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

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
15
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
3
by: ed | last post by:
I've just started working with .Net, so appologize for what is probably a really dumb question. Did Windows XP originally come with the .Net framework installed, and if so which version? ...
2
by: InvisibleMan | last post by:
Hi, I feel a little dumb for asking this (considering im writing TSQL) but there doesn't seem to be any definitive answers on the search engines... Okay I understand that if you open the ADO...
2
by: TGF | last post by:
How do you copy a String type into a native char buffer? Dumb question, but not sure how to do it :( TGF
5
by: Need Help | last post by:
This might be an extremely dumb question; I'm new to Visual C++, and am trying to use the simple Spooler API, OpenPrinter, but when I try to compile my source file, it says OpenPrinter is an...
10
by: Edward | last post by:
I've just taken over maintaining a system from a colleague who has left. I find the following line in her code: Dim params(2) As SqlClient.SqlParameter params(0) = New...
4
by: Stelrad Doulton | last post by:
Hi, Apologies if this isn't the correct forum. I am writing a communication solution (actually on the Compact Framework) based on HttpWebRequests hooking up with custom handlers on the...
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
6
by: Robert Dufour | last post by:
What is the meaning of the word marshal and unmarshal in plain english as applied to an exe file? Does it mean the application has started and ended? Thanks for any help, Happy new year, Bob
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.