Click here to Skip to main content
15,881,820 members
Home / Discussions / C#
   

C#

 
AnswerRe: A Question Of Structure Pin
Eytukan11-Apr-12 20:52
Eytukan11-Apr-12 20:52 
GeneralRe: A Question Of Structure Pin
Roger Wright11-Apr-12 21:37
professionalRoger Wright11-Apr-12 21:37 
AnswerRe: A Question Of Structure Pin
Mycroft Holmes11-Apr-12 21:21
professionalMycroft Holmes11-Apr-12 21:21 
GeneralRe: A Question Of Structure Pin
Roger Wright11-Apr-12 21:51
professionalRoger Wright11-Apr-12 21:51 
GeneralRe: A Question Of Structure Pin
PIEBALDconsult12-Apr-12 3:00
mvePIEBALDconsult12-Apr-12 3:00 
GeneralRe: A Question Of Structure Pin
Roger Wright12-Apr-12 5:18
professionalRoger Wright12-Apr-12 5:18 
AnswerRe: A Question Of Structure Pin
BobJanova11-Apr-12 23:57
BobJanova11-Apr-12 23:57 
QuestionConverting special string array into two different byte arrays Pin
MichCl11-Apr-12 8:22
MichCl11-Apr-12 8:22 
Hi,
I'm trying to convert this string array to byte array. I keep getting exceptions no matter what method I try. I tried following the example on another website, but it's not working and I can't figure out how to get it into my returned byte array. So it takes strings 40, AA, and 00 and puts them in a byte array. Even if I comment out the wBuf addition, it's throwing an exception when I run it.
I'm not sure if I'm showing the string array in the code correctly. It's like this:
dataString =
"40 A8"
"AA A8"
"00 4E"

private int ExtractBytesFromDataSTringArr(string[] dataString, ref byte[] wBuf, ref byte[] sBuf)
{
int line = 0;
string [] dataString= {"40 A8", "AA A8", "00 4E"};
for (int i=0; i < myStringArr.Length; i++)
{
   delimitedChar = ' ';
   stringArray = dataString[i].Split(new char[] {delimitedChar},   StringSplitOptions.RemoveEmptyEntries);

    int NumberChars = dataString[0].Length;
    byte[] byteArr = new byte[NumberChars/2];
    for (int j = 0; j < NumberChars; j+=2)
    {
        byteArr[j/2] = Convert.ToByte(dataString[0].Substring(j,2), 16);
        wBuf[line] += byteArr; //this doesn't compile
        //sBuf[line] is stringArray[1] equivalent
     }
     line++;
}

AnswerRe: Converting special string array into two different byte arrays Pin
PIEBALDconsult11-Apr-12 9:41
mvePIEBALDconsult11-Apr-12 9:41 
GeneralRe: Converting special string array into two different byte arrays Pin
MichCl11-Apr-12 10:11
MichCl11-Apr-12 10:11 
AnswerRe: Converting special string array into two different byte arrays Pin
OriginalGriff11-Apr-12 9:50
mveOriginalGriff11-Apr-12 9:50 
GeneralRe: Converting special string array into two different byte arrays Pin
MichCl12-Apr-12 5:00
MichCl12-Apr-12 5:00 
GeneralRe: Converting special string array into two different byte arrays Pin
OriginalGriff12-Apr-12 5:56
mveOriginalGriff12-Apr-12 5:56 
GeneralRe: Converting special string array into two different byte arrays Pin
MichCl17-Apr-12 7:42
MichCl17-Apr-12 7:42 
GeneralRe: Converting special string array into two different byte arrays Pin
OriginalGriff17-Apr-12 8:03
mveOriginalGriff17-Apr-12 8:03 
GeneralRe: Converting special string array into two different byte arrays Pin
MichCl17-Apr-12 8:34
MichCl17-Apr-12 8:34 
GeneralRe: Converting special string array into two different byte arrays Pin
OriginalGriff17-Apr-12 8:43
mveOriginalGriff17-Apr-12 8:43 
GeneralRe: Converting special string array into two different byte arrays Pin
MichCl17-Apr-12 9:15
MichCl17-Apr-12 9:15 
Suggestionproject Pin
Apurba Chatterjee11-Apr-12 8:18
Apurba Chatterjee11-Apr-12 8:18 
AnswerRe: project Pin
ZurdoDev11-Apr-12 8:33
professionalZurdoDev11-Apr-12 8:33 
GeneralRe: project Pin
Big Daddy Farang11-Apr-12 9:18
Big Daddy Farang11-Apr-12 9:18 
JokeRe: project Pin
ZurdoDev11-Apr-12 9:19
professionalZurdoDev11-Apr-12 9:19 
JokeRe: project Pin
V.11-Apr-12 21:02
professionalV.11-Apr-12 21:02 
GeneralRe: project Pin
ZurdoDev12-Apr-12 1:47
professionalZurdoDev12-Apr-12 1:47 
GeneralRe: project Pin
RobCroll11-Apr-12 18:52
RobCroll11-Apr-12 18:52 

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.