DOS Printf problem
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 502 from 2013/5/29
    Trying to debug a few lines of code I use Printf() because I cant use stdio printf() when I use SDL (I dont know why).
    The problem is that Printf() doesnt show my data.

    A little example:

    Code:

    include<stdio.h>
    #include<proto/dos.h>

    typedef struct datos
    {
    int x;
    }datos;

    datos misdatos;

    datos *p_data = &misdatos;

    void showdata(datos *data)
    {
    printf("Dato X: %dn", data->x);
    }

    int main()
    {
    p_data->x = 100;
    showdata(p_data);
    return 0;
    }


    If I use stdio version It works well but with DOS version it shows always Dato X: 0.



    [ Edited by tolkien 10.11.2013 - 11:10 ]
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »10.11.13 - 10:08
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    naTmeg
    Posts: 135 from 2004/2/8
    Quote:

    tolkien wrote:
    printf("Dato X: %d\n", data->x);



    There is a bug somewhere, try:

    printf("Dato X: %ld\n", data->x);
  • »10.11.13 - 10:16
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 502 from 2013/5/29
    Hi! It works in this simple example. Any other bug to be aware? ;)

    Thanks naTmeg!
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »10.11.13 - 11:13
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    naTmeg
    Posts: 135 from 2004/2/8
    Quote:

    tolkien wrote:
    Hi! It works in this simple example. Any other bug to be aware? ;)



    No, except you could optimize:

    typedef struct datos {
    int x;
    }datos;

    to

    typedef struct {
    int x;
    }datos;

    :)
  • »10.11.13 - 11:19
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 502 from 2013/5/29
    Oh mate! Im a poor noob hehe thanks. I learn everyday.
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »10.11.13 - 11:23
    Profile