Reading an hex offset from command-line argument

This is a discussion on Reading an hex offset from command-line argument within the C Programming forums, part of the General Programming Boards category; Hi, I need some help to finish a simple program. I want to make it read a hex number from ...

  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
    32,821
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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-08-2004, 12:40 AM
  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, 08:23 AM
  5. Replies: 1
    Last Post: 04-05-2002, 11:19 AM

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