Data Type Question
I have a general question about the byte datatype, though this will get a little complex at the end. Now I know that when I declare a variable as a byte that it consumes 1byte of memory, so does that mean if I declare a byte array of say 100 that it is using 100 bytes?
Next question is in regards to streams, I am reading data into a byte array (text and binary data) and this is fine until I reach a stream that has more then 1MB of data in it. Streams that are <= 999KB do not cause me a problem, anything larger then that causes me application to fail. (The aspnet_wp.exe terminates in the task manager, however, this isnt due to an out of memory error as the process maintains its current memory usage and my server still has ~800mb avail) So the question is, do byte arrays have a max limit that, if you go past a certain point, it causes an overflow?
My work around to this was to create a filestream and stream the byte data to a text file as it was coming down, and this works like a charm, except when i got to retrieve the data. I write the buffer directly to the filestream, it is inside of that stream that the byte gets converted to its character representation automatically. Now when this stream is done I close it for writing and open it for reading and read the stream into a string, now i want to convert that string back to its byte representation so i use System.Text.Encoding.Default.GetBytes(string) somewhere between the writing and the converting my data gets corrupted and I dont know why. The reason i know this is because I wrote out both the original byte array length and the string length and then also the byte array length that i populate from the string. My second byte array is always substanitally smaller then my original byte array, can anyone please explain this to me???
"The one language all programmers understand is profanity."
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click
on their post!
"Easy is the path to wisdom for those not blinded by themselves."