Troubles with the sscanf-function in C on HP50 - Hewlett Packard

This is a discussion on Troubles with the sscanf-function in C on HP50 - Hewlett Packard ; Gents, I am not very experienced in C and I have got a problem with the following c-code on a HP50: #include int main() { clear_screen(); int check = 0; char formel[40]; char forelem[5][3]; int foranz[5] = { 0, 0, ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Troubles with the sscanf-function in C on HP50

  1. Troubles with the sscanf-function in C on HP50

    Gents,
    I am not very experienced in C and I have got a problem with the
    following c-code on a HP50:

    #include

    int
    main()
    {
    clear_screen();


    int check = 0;
    char formel[40];
    char forelem[5][3];
    int foranz[5] = { 0, 0, 0, 0, 0 };


    gets(formel);
    check = sscanf(formel, "%2s %d", forelem[0], &foranz[0]);
    printf("%d\n", check);



    WAIT_CANCEL;
    return 0;

    The sscanf-function should deliver the number of correct read fields
    as integer "check". I put this on various platforms e.g. Bloodshed
    etc. and it worked fine. On the HP50 this delivers "2" regardless if I
    want to read 2 character fields or one character and one integer
    separated by a blank. Even if one input is missing at all, this
    delivers "2". So the check of the correctness of the input is
    impossible.
    Does anybody have any ideas to help me??

    Best regards

    lionboy


  2. Re: Troubles with the sscanf-function in C on HP50

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    lionboy wrote:
    > Gents,


    > I am not very experienced in C and I have got a problem with the
    > following c-code on a HP50:


    <..>

    > The sscanf-function should deliver the number of correct read fields
    > as integer "check".


    <..>

    > Does anybody have any ideas to help me??


    please read: http://hpgcc.org:8080/pebble/2006/02...895876842.html


    > Best regards
    >
    > lionboy
    >



    - --
    Ingo Blank

    http://hpgcc.org
    http://blog.hpgcc.org
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (MingW32)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFGfuJzr9bi0BQTf30RAjnxAJ4gspQheD7mLhbmJnXIJq RiuO76AgCg5dlv
    cZgoGU8fGSYh7q/hqgPFEN8=
    =odb7
    -----END PGP SIGNATURE-----

  3. Re: Troubles with the sscanf-function in C on HP50

    On 24 Jun., 23:30, Ingo Blank
    wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > lionboy wrote:
    > > Gents,
    > > I am not very experienced in C and I have got a problem with the
    > > following c-code on a HP50:

    >
    > <..>
    >
    > > The sscanf-function should deliver the number of correct read fields
    > > as integer "check".

    >
    > <..>
    >
    > > Does anybody have any ideas to help me??

    >
    > please read:http://hpgcc.org:8080/pebble/2006/02...895876842.html
    >
    > > Best regards

    >
    > > lionboy

    >
    > - --
    > Ingo Blank
    >
    > http://hpgcc.orghttp://blog.hpgcc.org
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.6 (MingW32)
    > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
    >
    > iD8DBQFGfuJzr9bi0BQTf30RAjnxAJ4gspQheD7mLhbmJnXIJq RiuO76AgCg5dlv
    > cZgoGU8fGSYh7q/hqgPFEN8=
    > =odb7
    > -----END PGP SIGNATURE-----

    Thanks Ingo! So the check on the right input is not working with
    sscanf. Do you have any workaround for my (for you probably small)
    problem??

    best regards

    lionboy


+ Reply to Thread