validation routine help plz

This is a discussion on validation routine help plz within the C Programming forums, part of the General Programming Boards category; hi can anyone send me a perfect date validation routing and string validation routine in C thanks raajesh...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    45

    validation routine help plz

    hi

    can anyone send me a perfect date validation routing and string validation routine in C

    thanks


    raajesh

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: validation routine help plz

    Originally posted by rajesh23
    hi

    can anyone send me a perfect date validation routing and string validation routine in C

    thanks


    raajesh
    Shouldn't you be doing your own homework? String validation? That's easy. strcmp

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    45
    hello

    u dint get my question right. I want to find whether the input is a string or not. What u gave is string verification and not validation?

    raajesh

  4. #4
    twm
    twm is offline
    root
    Join Date
    Sep 2003
    Posts
    232
    >I want to find whether the input is a string or not.
    Ah, easy questions! All input is a string, problem solved! As long as you don't use one of those nasty little buggers like *scanf or fread you can be pretty darn sure that you've got a string until you decide to convert it to something else. Next question!
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  5. #5
    Registered User RussMan's Avatar
    Join Date
    Sep 2003
    Posts
    14
    Question: What is a string? Its a array of numbers (ascii values). So a string verifier doesn't make sense. Plus your using c so you will declare a string if you except use input (other then numbers unless you want) so it will be a string. So unless i am missing something there is something your not saying.

  6. #6
    twm
    twm is offline
    root
    Join Date
    Sep 2003
    Posts
    232
    >Its a array of numbers (ascii values).
    Close. In C a string is an array of characters (printable interger values) ending with \0. And don't go assuming ASCII either, some wierdos actually use other character sets.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by rajesh23
    hello

    u dint get my question right. I want to find whether the input is a string or not. What u gave is string verification and not validation?

    raajesh
    No I didn't. You didn't make yourself clear. You said you wanted to validate a date and a string.

    First off, your string question doesn't make sense at all. Input is whatever you read it as. Nothing more, nothing less.

    If you read input as numbers, it's numbers. If you read it all into a buffer and call it a string, then it's a string.

    So basicly you wanted to know how to read a string. If you can't even do that, you should start over in your C book. If you know how to do that, then why on earth are you asking how to?

    You didn't specify anything more than "string validation". Everything can be a string. It's up to you to make it more. You use input routines that give you numbers, characters, or whatever.

    Furthermore, you didn't say if you where you were reading from. Any "string" input can also be simply a bunch of numbers.

    Consider:

    input: "abcd"

    This can be a string of "abcd", or, it could be one 32 bit number, depending on how much you're reading, and how you read it.

    fread( &longint, sizeof( long int ), 1, inputstream );

    There you go. Now "abcd" is a single long integer. Input is whatever you want it to be. They're all bits and bytes.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>some wierdos actually use other character sets.
    Oi ! I take that personally
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  9. #9
    twm
    twm is offline
    root
    Join Date
    Sep 2003
    Posts
    232
    >Oi ! I take that personally
    You'll recover.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 10:19 PM
  2. Replies: 11
    Last Post: 05-10-2009, 09:51 AM
  3. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 09:54 AM
  4. [C#] Validation class for events?
    By gicio in forum C# Programming
    Replies: 4
    Last Post: 01-03-2003, 12:19 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 09:44 AM

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