Thread: Strings

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    20

    Strings

    I am working on a string class, which asks the user for a string. I have a fixed length array size of 100. I have to ensure that the string length is less 100, if its greater than 100 it only copies 99 charachters...i've been playing with this and cant get it. Any ideas?

    Thanks

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    if you want to be able to enter 100 char put the array size as 101 ie because of the extra null char.

    there is the strlen() funtion in string.h to tell you with the length of the string entered.
    -

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