Decoding and Encoding from file?

This is a discussion on Decoding and Encoding from file? within the C++ Programming forums, part of the General Programming Boards category; I have to decode and encode data from a file I just finished the decoding part. There is a file ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    9

    Question Decoding and Encoding from file?

    I have to decode and encode data from a file
    I just finished the decoding part. There is a file containing 5-6 digits integers that be separated by even or odd and then the even integers decoded to ascii char.

    Now I have to do the opposite. I have a new file with ascii char that i need convert to 5-6 digits even and odd integers.

    How do I begin ?I've already read in the char from the file.

    Here's a link, this is the ascii char read from the file to the screen.
    https://www.dropbox.com/s/sa7r70hpfnsttzg/C%2B%2B.jpg?m

  2. #2
    Registered User
    Join Date
    Nov 2012
    Location
    Some rock floating in space...
    Posts
    32
    if the least significant bit of the least significant byte is set, then it's an odd number. if it isn't set, then it's an even number e.g. isodd = ((value & 1)?ODD:EVEN); where ODD and EVEN are defined like TRUE and FALSE.. or you could simply say isodd = value % 2; to see if it's odd

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,307
    You've started a new thread for the same thing and again what you are writing doesn't make much sense.

    I suggest you start here: How To Ask Questions The Smart Way
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with code for encoding and decoding letters
    By decxan in forum C Programming
    Replies: 1
    Last Post: 10-28-2010, 12:39 PM
  2. Url query encoding/decoding
    By Niara in forum Networking/Device Communication
    Replies: 6
    Last Post: 04-25-2007, 03:30 PM
  3. rot13 decoding/encoding help!!!!!
    By zaff1 in forum C++ Programming
    Replies: 0
    Last Post: 02-06-2003, 03:59 PM
  4. Decoding & Encoding the sound?!?
    By waldis in forum C++ Programming
    Replies: 2
    Last Post: 10-20-2002, 06:41 PM
  5. decoding/encoding
    By simhap in forum C++ Programming
    Replies: 3
    Last Post: 11-18-2001, 09:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21