Reading in a file to a structure

  • Thread starter Thread starter wvueagle84
  • Start date Start date
W

wvueagle84

Hello,

Any help on this would be great. I have a text file that is in
following format

Name code (which is read in as byte[])

one 21AE
two 95EC
three 88AB

and so on and so forth

I want to be able to read in the text file and put the name into the
name field of the structure and the 2 bytes of hex (code) into the
code portion of the structure.

Any pointers/advice??

Thanks
 
Hello,

Any help on this would be great. I have a text file that is in
following format

Name code (which is read in as byte[])

one 21AE
two 95EC
three 88AB

and so on and so forth

I want to be able to read in the text file and put the name into the
name field of the structure and the 2 bytes of hex (code) into the
code portion of the structure.

Any pointers/advice??

Thanks
Read the text file one line at a time into a string. Split each line
into two smaller strings. Put the first string into your
MyStruct.Name field. Parse the second string into a byte[] and put it
into yourMyStruct.Code field.

Make your best attempt at the above. If you are having problems then
post the code here explaining what your problems are and we can help
you.

We don't do homework.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top