Click here to Skip to main content
15,907,395 members
Home / Discussions / C#
   

C#

 
Generali m getting an error while using array, please help me Pin
somasekhara7774-Jul-12 1:56
somasekhara7774-Jul-12 1:56 
SuggestionRe: i m getting an error while using array, please help me Pin
Eddy Vluggen4-Jul-12 2:05
professionalEddy Vluggen4-Jul-12 2:05 
AnswerRe: i m getting an error while using array, please help me Pin
markovl4-Jul-12 2:16
markovl4-Jul-12 2:16 
AnswerRe: i m getting an error while using array, please help me Pin
Pete O'Hanlon4-Jul-12 2:16
mvePete O'Hanlon4-Jul-12 2:16 
GeneralRe: i m getting an error while using array, please help me Pin
markovl4-Jul-12 2:21
markovl4-Jul-12 2:21 
GeneralRe: i m getting an error while using array, please help me Pin
Pete O'Hanlon4-Jul-12 2:32
mvePete O'Hanlon4-Jul-12 2:32 
AnswerRe: i m getting an error while using array, please help me Pin
Luc Pattyn4-Jul-12 11:36
sitebuilderLuc Pattyn4-Jul-12 11:36 
GeneralProblem with Writing FileStream Pin
Software20074-Jul-12 0:01
Software20074-Jul-12 0:01 
I have a stream object coming from mobile client in binary fromat as follows
C#
name=tony&image=....raw binary representation of an image.....


I would like to extract the image out of the stream. I can extract the image and show it fine as long as string size preceding the binary image data is 16 chars or less! ("name=tony&image=") is 16 chars long
C#
bool PostData(Stream stream)
{
  using (FileStream filetoUpload = new FileStream(filePath + "ImageFromBytes.jpg",  FileMode.Create))
  {
    byte[] byteArray = new byte[10000];
    int bytesRead = 0;
    bytesRead = stream.Read(byteArray, 0, byteArray.Length);

 //write image data, ignore the preceding string
 if (bytesRead > 0)
    filetoUpload.Write(byteArray, 16, bytesRead-16);
   ....
  }
}


If I do("name=randy&image=") = 17 chars long, it doesn't work, the image shows the right size, but can't be opened.
C#
name=randy&image=....raw binary representation of an image.....

filetoUpload.Write(byteArray, 17, bytesRead-17);


Any ideas what in the world is going on?
GeneralRe: Problem with Writing FileStream Pin
Richard MacCutchan4-Jul-12 0:21
mveRichard MacCutchan4-Jul-12 0:21 
GeneralRe: Problem with Writing FileStream Pin
Pete O'Hanlon4-Jul-12 0:29
mvePete O'Hanlon4-Jul-12 0:29 
GeneralRe: Problem with Writing FileStream Pin
Richard MacCutchan4-Jul-12 3:47
mveRichard MacCutchan4-Jul-12 3:47 
GeneralRe: Problem with Writing FileStream Pin
Pete O'Hanlon4-Jul-12 4:05
mvePete O'Hanlon4-Jul-12 4:05 
GeneralRe: Problem with Writing FileStream Pin
Richard MacCutchan4-Jul-12 4:20
mveRichard MacCutchan4-Jul-12 4:20 
GeneralRe: Problem with Writing FileStream Pin
Pete O'Hanlon4-Jul-12 4:40
mvePete O'Hanlon4-Jul-12 4:40 
GeneralRe: Problem with Writing FileStream Pin
Luc Pattyn4-Jul-12 1:33
sitebuilderLuc Pattyn4-Jul-12 1:33 
GeneralRe: Problem with Writing FileStream Pin
Software20074-Jul-12 7:16
Software20074-Jul-12 7:16 
GeneralRe: Problem with Writing FileStream Pin
Trak4Net4-Jul-12 7:47
Trak4Net4-Jul-12 7:47 
GeneralRe: Problem with Writing FileStream Pin
Luc Pattyn4-Jul-12 8:02
sitebuilderLuc Pattyn4-Jul-12 8:02 
GeneralRe: Problem with Writing FileStream Pin
Software20074-Jul-12 11:07
Software20074-Jul-12 11:07 
GeneralRe: Problem with Writing FileStream Pin
Trak4Net4-Jul-12 11:29
Trak4Net4-Jul-12 11:29 
GeneralRe: Problem with Writing FileStream Pin
Software20074-Jul-12 11:46
Software20074-Jul-12 11:46 
QuestionC# code obtain and compares Pin
sc steinhayse3-Jul-12 15:13
sc steinhayse3-Jul-12 15:13 
AnswerRe: C# code obtain and compares Pin
RobCroll3-Jul-12 17:18
RobCroll3-Jul-12 17:18 
AnswerRe: C# code obtain and compares Pin
Abhinav S3-Jul-12 17:24
Abhinav S3-Jul-12 17:24 
AnswerRe: C# code obtain and compares Pin
Pete O'Hanlon3-Jul-12 22:17
mvePete O'Hanlon3-Jul-12 22:17 

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.