Thread: Need help writing a program that reads from a file and converts it to binary.

  1. #1
    Registered User
    Join Date
    Dec 2005

    Need help writing a program that reads from a file and converts it to binary.

    Hello folks. I am trying to teach myself C and am having little luck so far. I can follow the books examples fairly well but when it comes time to write my own program, I get stuck.
    The book has me write a little self-test program but offers no help whatsoever. The program is supposed to read the following from a .txt file (ASCII format):

    01 801
    02 901
    03 802
    04 902
    05 803
    06 903
    07 804
    08 904
    09 805
    10 905

    It is then supposed to convert only the second set of numbers to binary! (Exclude the first, like 01-10).
    EX: Instead of converting 01 801 to binary, it is only supposed to convert 801!

    Does anyone have any idea on how to do this? Any help is appreciated as I am completely stuck and since the book does not have a coded example I donít even know where to start. I can skip this example but I do not wish to because I actually want to know how to do this.
    If anyone has coded something like this before, can you please post your code? If I canít do it, I would at least like to see what it looks like.



  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-05-2009, 09:42 AM
  2. Replies: 4
    Last Post: 08-24-2007, 05:28 PM
  3. Binary comparison
    By tao in forum Windows Programming
    Replies: 0
    Last Post: 06-28-2006, 12:10 PM
  4. Print binary numbers to disk file, problem
    By Guti14 in forum C Programming
    Replies: 4
    Last Post: 10-04-2004, 07:33 AM
  5. IDEA: A program to make a graphic of any file
    By carrja99 in forum Contests Board
    Replies: 1
    Last Post: 10-21-2002, 12:33 PM