Announcement

Collapse
No announcement yet.

CString konvertieren nach long, float mit Überprüfung

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CString konvertieren nach long, float mit Überprüfung

    Hallo,

    UNICODE-Projekt..
    bisher folgender Code
    Code:
    bool CheckType_NUM(CString ex_val)
    {
      long i_test = _tstol(ex_val);
      // Fehlerbehandlung bei Strings.....Umwandlung Error.....
    }
    Erhalte ich von einem Fremdgerät den String "11w",
    so macht mir die Funktion _tstol -> i_test = 11;
    Aber in diesem Fall müßte eine Exception, Umwandlung fehlerhaft.

    Aber wie ?

    M.H

  • #2
    _tstol
    The function stops reading the input string at the first character that it cannot recognize as part of a number.
    Christian

    Comment


    • #3
      Das ist soweit korrekt,
      gibt es nich eine andere Funktion für long, float die bei Umwandlung eine Exception werfen würden ?
      Ich muß ja nur herausfinden, das keine Zahl vorliegt.


      M.H

      Comment


      • #4
        Dann matche den CString mit einem regulärem Ausdruck
        Christian

        Comment

        Working...
        X