Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralRe: hi its very urgent Pin
V.19-Jan-07 4:08
professionalV.19-Jan-07 4:08 
GeneralRe: hi its very urgent Pin
Stefan Troschuetz19-Jan-07 4:14
Stefan Troschuetz19-Jan-07 4:14 
AnswerRe: hi its very urgent Pin
Stefan Troschuetz19-Jan-07 0:51
Stefan Troschuetz19-Jan-07 0:51 
GeneralRe: hi its very urgent Pin
Guffa19-Jan-07 0:54
Guffa19-Jan-07 0:54 
AnswerRe: hi its very urgent Pin
V.19-Jan-07 1:20
professionalV.19-Jan-07 1:20 
AnswerRe: hi its very urgent Pin
ednrgc19-Jan-07 1:55
ednrgc19-Jan-07 1:55 
AnswerRe: hi its very urgent Pin
Dan Neely19-Jan-07 2:37
Dan Neely19-Jan-07 2:37 
AnswerRe: hi its very urgent Pin
BedHead19-Jan-07 3:10
BedHead19-Jan-07 3:10 
AnswerRe: hi its very urgent Pin
Christian Graus19-Jan-07 8:26
protectorChristian Graus19-Jan-07 8:26 
AnswerRe: hi its very urgent Pin
David Domingues22-Jan-07 5:43
David Domingues22-Jan-07 5:43 
Questionproblem in Datagrid Pin
Murtuza Husain Miyan Patel19-Jan-07 0:07
professionalMurtuza Husain Miyan Patel19-Jan-07 0:07 
AnswerRe: problem in Datagrid Pin
Mircea Puiu19-Jan-07 1:09
Mircea Puiu19-Jan-07 1:09 
GeneralRe: problem in Datagrid Pin
Drew McGhie19-Jan-07 4:55
Drew McGhie19-Jan-07 4:55 
QuestionSSIS Component Pin
NK718-Jan-07 23:12
NK718-Jan-07 23:12 
AnswerRe: SSIS Component Pin
Mircea Puiu19-Jan-07 1:24
Mircea Puiu19-Jan-07 1:24 
QuestionSSIS Package Creation Pin
NK718-Jan-07 23:09
NK718-Jan-07 23:09 
Questionchanging color of the pointed treeView node Pin
samtam18-Jan-07 22:15
samtam18-Jan-07 22:15 
AnswerRe: changing color of the pointed treeView node Pin
Christian Graus18-Jan-07 22:57
protectorChristian Graus18-Jan-07 22:57 
AnswerRe: changing color of the pointed treeView node Pin
Mircea Puiu19-Jan-07 1:03
Mircea Puiu19-Jan-07 1:03 
QuestionGeneric sum Pin
V. Thieme18-Jan-07 22:15
V. Thieme18-Jan-07 22:15 
AnswerRe: Generic sum Pin
Russell Jones18-Jan-07 22:38
Russell Jones18-Jan-07 22:38 
GeneralRe: Generic sum Pin
V. Thieme18-Jan-07 23:37
V. Thieme18-Jan-07 23:37 
AnswerRe: Generic sum Pin
Christian Graus18-Jan-07 22:57
protectorChristian Graus18-Jan-07 22:57 
GeneralRe: Generic sum Pin
V. Thieme18-Jan-07 23:36
V. Thieme18-Jan-07 23:36 
QuestionLoading an image as a byte array Pin
Russell Jones18-Jan-07 22:11
Russell Jones18-Jan-07 22:11 
I'm trying to load an image into a byte array. The following code seems to be OK for the moment but i'm worried that it's not right.

FileStream fs = new FileStream(FileName,FileMode.Open);<br />
byte [] ImageData = new byte[fs.Length];<br />
fs.Read(ImageData,0,(int)fs.Length);


Firstly, while i can't see anyone loading files bigger than int.MaxValue any time soon, it's always nice to future proof your code and someone might load a video that big, even today. For the application I'm using it for I'll probably block files over about 10 Meg anyway so I can ignore this issue.(I might stick in a LATER: comment and come back to it)

Second and of more immediate concern is that I read somewhere (but have now lost the link) that fs.Read will block until it has some data, not necessarily all the data in the stream.

Is my simple code OK or should I be checking whether the stream is fully loaded before i do things with the data? It seems to work allright at the moment but this is a reasonably fast machine with good disks and not much swap file use.

Russell

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.