Thread: Reading an hex offset from command-line argument

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    30

    Question Reading an hex offset from command-line argument

    Hi, I need some help to finish a simple program.

    I want to make it read a hex number from a command-line argument and use it as an integer, for the fseek command.

    It works like this: copypart.exe infile 0x8000 outfile

    The result is that everything from 0x8000 to EOF will be copied to outfile.

    I know how to access the command line arguments, however I don't know how can I convert the string "0x8000" to a integer so that it can be used by the fseek command. Could someone post a pratical code exemple of how to do that?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2006, 07:25 PM
  2. converting hex to dec
    By jibbles in forum C Programming
    Replies: 20
    Last Post: 08-07-2004, 11:40 PM
  3. Reading A Byte From A Certain Offset
    By 4point5 in forum Windows Programming
    Replies: 1
    Last Post: 10-31-2002, 06:36 PM
  4. HEX and BCD coded file READING !!
    By mehuldoshi in forum C Programming
    Replies: 2
    Last Post: 07-31-2002, 07:23 AM
  5. Replies: 1
    Last Post: 04-05-2002, 11:19 AM