Thread: strings

  1. #1


    hello, i am reading a line from a file "1002.99F" for example then i am trying to create a new buffer that only has the 1002.99 and forgets about the F. im sure this isnt that difficult but i have tried and tried and cant seem to find a way. any advice would be great. thanks.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Find the length of the char array(strlen(var)) or string(var.length()), and only copy length-1 characters to your new variable. If your new variable is a char array, be sure to create one extra index position and set the last character equal to '\0'. There are some functions, like atof(), that will convert char arrays to numeric types, if that is your ultimate goal.
    Last edited by 7stud; 05-19-2003 at 01:17 AM.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 03:24 PM
  2. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 08:07 PM
  3. Reading strings input by the user...
    By Cmuppet in forum C Programming
    Replies: 13
    Last Post: 07-21-2004, 06:37 AM
  4. damn strings
    By jmzl666 in forum C Programming
    Replies: 10
    Last Post: 06-24-2002, 02:09 AM
  5. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM