When I want to Read the Bytes 1000-2000 from a Stream into a ByteArray using
Stream.Read(byt eArray,1000,200 0)
they are written to the positions 1000-2000 in the byteArray.
but my Array is only 1000 items long Array(0-999), and i just want to have
the positions 1000-2000 from the stream!
How can i realize it that the bytes 1000-2000 are written to an Array of
length=1000
PS: The Stream is reading from the Internet
Thanx in advice 1 1007
Daniel von Fersen wrote: When I want to Read the Bytes 1000-2000 from a Stream into a ByteArray using
Stream.Read(byt eArray,1000,200 0)
they are written to the positions 1000-2000 in the byteArray. but my Array is only 1000 items long Array(0-999), and i just want to have the positions 1000-2000 from the stream!
How can i realize it that the bytes 1000-2000 are written to an Array of length=1000
Trick answer: Never... counting from 1000 to 2000 gives you 1001 bytes ;-)
You misinterpreted the meaning of the parameters passed to Stream.Read().
The third parameter is not an end index (that would be a rather strange
notion regarding streams), but the numbers of bytes you want to read at
most. Thus, if you want to consume 1000 bytes starting at index 1000, use
someStream.Read (buffer, 1000, 1000);
BTW, there is a framework group that is more appropriate for these kinds of
questions.
Cheers,
--
Joerg Jooss jo*********@gmx .net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Detlef Hüttenbach |
last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the
images aren't shown when loaded from streams:
In a WebForm, the image's property "ImageUrl" is set to a handler, and this
handler gets the image from a database.
Please check the various image formats. (The images are stored in a SQL
database as Image type.)
I post you a demo HTTP handler below.
I guess, it's the ViewState which messes up (in Windows Forms I...
|
by: Daniel von Fersen |
last post by:
When I want to Read the Bytes 1000-2000 from a Stream into a ByteArray using
Stream.Read(byteArray,1000,2000)
they are written to the positions 1000-2000 in the byteArray.
but my Array is only 1000 items long Array(0-999), and i just want to have
the positions 1000-2000 from the stream!
How can i realize it that the bytes 1000-2000 are written to an Array of
|
by: Daniel von Fersen |
last post by:
Hallo,
Wenn ich mit Stream.Read(buffer,1000,2000) 1000 bytes in ein Bytearray
einlesen möchte werden diese Bytes an die positionen 1000-2000 geschrieben!
Ich möchte jedoch (da ich nur diesen Teil auslesen möchte, dass
diese Bytes halt an positionen 1000-2000 geschrieben werden,
da mein Array lediglich die Länge 1000 hat.
Quasi: Ich möchte die Position 1000-2000 aus dem Stream lesen und jedoch in
ein Array der Länge 2000-1000 also...
|
by: Daniel von Fersen |
last post by:
When I want to Read the Bytes 1000-2000 from a Stream into a ByteArray using
Stream.Read(byteArray,1000,2000)
they are written to the positions 1000-2000 in the byteArray.
but my Array is only 1000 items long Array(0-999), and i just want to have
the positions 1000-2000 from the stream!
How can i realize it that the bytes 1000-2000 are written to an Array of
|
by: bill tie |
last post by:
How do I convert ADODB.Stream into an array of bytes?
Thank you.
| |
by: Simon Rigby |
last post by:
Hi folks,
Apologies if this is not directly relevant but I was struggling to find
a group with the appropriate context. So as my problem is in an aspx
web site I thought I'd try here first. Please feel free to suggest a
more relevent group.
I have some code that I am using to build a stream (test text at this
stage, although eventually will come from a database query). I want to
have this available as a download without having to...
|
by: pax82 |
last post by:
hi, sorry for my english but i don't speak good english.
in this web service i send 2 data stream(xml and xsl file) and i would like to return a xslt trasform-file byte array (now i return string because i'm in testing)
when the transResult file is been created, it's source is all NULL char.
why? where i'm wrong?
public string getData(byte xmlData, byte xslData)
{
|
by: Icemokka |
last post by:
Hi,
I'm need to upload a big file ( 600Mb+ ) to a BLOB field in MSSQL
2005.
My code looks like this :
fs = New FileStream(sFilePath, FileMode.Open)
Dim ByteArray(fs.Length) As Byte
fs.Read(ByteArray, 0, fs.Length)
|
by: vishnu |
last post by:
Hi,
Am trying to post the data over https and am getting error in
httpwebresponse.getResponseStream.Please help me to get rid of this
issue.
Here is the message from immediate window
?myResp.GetResponseStream()
{System.Net.ConnectStream}
|
by: Nitin Mahajan |
last post by:
Guys
Is there a way in C# to create a word object directly from a memory
stream without passing that to hard disk (file stream). I think it
doesn't makes sense to create a file just to read it again in to word
object. If some one has some brilliant idea please share.
In a nutshell this is what I'm currently doing
ByteArray --File Stream --Word Object
and this I want to do
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |