Search:

Type: Posts; User: john7

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    327

    This way it works void MyPrintf(int argc,...

    This way it works


    void MyPrintf(int argc, ...)
    {
    int i;
    int val;
    char *strp;
    VAR var;
  2. Replies
    4
    Views
    327

    I did it this way typedef struct { ...

    I did it this way



    typedef struct
    {
    void *value;
    int type;
    }VAR;
  3. Replies
    4
    Views
    327

    I see. Like %s tells it's a string. Thank you.

    I see. Like %s tells it's a string. Thank you.
  4. Replies
    4
    Views
    327

    Variable function arguments.

    I want to use variable arguments


    void va_test(int num_args, ...)
    {
    va_list valist;

    va_start(valist, num_args);

    for (int i = 0; i <= num_args; i++)
  5. Replies
    5
    Views
    415

    I see. Thank you.

    I see. Thank you.
  6. Replies
    5
    Views
    415

    This way I can not iterate - on dict[j]->name...

    This way

    I can not iterate - on dict[j]->name I get Error[Pe044]: expression must have pointer type

    This way

    I pass it by value - a local copy - I can not modify a member - dict[j]->value...
  7. Replies
    5
    Views
    415

    Passing a pointer to struct array

    I have a struct


    typedef struct
    {
    char *name;
    float value;
    void *pntr;
    uint8_t found;
    }DICTIONARY;
  8. Replies
    7
    Views
    880

    This variant will do. I always work with 32-bit...

    This variant will do. I always work with 32-bit platform. int will cover all values I ever need. Thank you.

    or even better


    typedef union
    {
    uint8_t *ptr;
    int16_t *ptr;
    int32_t...
  9. Replies
    7
    Views
    880

    I 'm very short on space. So instead allocating ...

    I 'm very short on space.
    So instead allocating


    typedef struct
    {
    void *ptr;
    int val;
    }
  10. Replies
    7
    Views
    880

    Using pointer address as a value

    Say I have


    void *var_ptr;

    I can initialize it with some address


    var_ptr = (int *) 100;
  11. Replies
    10
    Views
    1,016

    Yes. The only way. I was trying to avoid it cause...

    Yes. The only way. I was trying to avoid it cause it inflates my struct (it's actually an array of struct) and it consumes a lot of space, so I'm struggling for every byte.
  12. Replies
    10
    Views
    1,016

    No! Let me simplify for better understanding. ...

    No! Let me simplify for better understanding.


    switch (type)
    {
    case TYPE_u8:
    *(uint8_t*)res = *(uint8_t*)l + *(uint8_t*)r;
    break;
    case TYPE_u16:
    ...
  13. Replies
    10
    Views
    1,016

    sorry. I missed to understand. how can I do it...

    sorry. I missed to understand. how can I do it practically? the only way I see - to add some variable
    type_size = sizeof(my_current_var);
    and according to a type_size do some cast in...
  14. Replies
    10
    Views
    1,016

    But how I decide what type to cast? It is generic...

    But how I decide what type to cast? It is generic function


    void SCRIPT_Process(void *l_var, void *r_var, uint32_t oper)
    {
    int32_t res;

    switch (oper)
    {
    case OP_PLUS:
  15. Replies
    10
    Views
    1,016

    Working with void pointers

    I have a struct


    typedef struct
    {
    void *l_var;
    void *r_var;
    }EXPR;

    EXPR expr;
  16. Replies
    4
    Views
    906

    thank you.

    thank you.
  17. Replies
    4
    Views
    906

    It's void because I have a struct typedef...

    It's void because I have a struct


    typedef struct
    {
    uint8_t ena;
    uint8_t debug;
    uint8_t mode;
    uint8_t con_mode;
  18. Replies
    4
    Views
    906

    An assignmentof a void argument

    If I write


    void COM_Esp8266ParamRead(char* param, void *ret_val)
    {
    if(strcmp(param,"locip")==0)
    {
    ret_val = esp_params.loc_ip; //char loc_ip[15]
    }
    }
  19. Replies
    2
    Views
    771

    Thank you. My bad.

    Thank you. My bad.
  20. Replies
    2
    Views
    771

    String navigation

    I have an array of strings


    char * s_MainMenu[] =
    {
    "MAINT ",
    " AUTO ",
    "MANUAL",
    "FAILS "
    };
  21. Replies
    6
    Views
    1,490

    I see. Thank you.

    I see. Thank you.
  22. Replies
    6
    Views
    1,490

    OK. This way static MENU_ITEM...

    OK. This way

    static MENU_ITEM sub_menu_fails[][4] =
    {
    { {0, "MF"}, { 1, "HF"}, { 2, "FAILED"}, { 3, "BACK"} },
    { {0, "MF"}, { 1, "HF"}, { 2, "FAILED"} }
    };
    it compiles.
    But here
  23. Replies
    6
    Views
    1,490

    But this MENU_ITEM *submenu; MENU_ITEM...

    But this


    MENU_ITEM *submenu;
    MENU_ITEM sub_menu_fails[] = { {0, "NULL"}, {0, "MF"}, { 1, "HF"}, { 2, "FAILED"}, { 3, "BACK"} };

    And this


    MENU_ITEM **submenu;
  24. Replies
    6
    Views
    1,490

    Two dimensional array of struct.

    I define


    typedef struct
    {
    uint32_t menu_id;
    char *menu_text;
    }MENU_ITEM;

    typedef struct
  25. Thread: Write to struct

    by john7
    Replies
    2
    Views
    589

    Thank you very much.

    Thank you very much.
Results 1 to 25 of 54
Page 1 of 3 1 2 3