Search:

Type: Posts; User: nime

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    1,255

    Getting const char* array from function

    Hello,
    Now I am stuck with getting const char* array from function to main.

    main:



    const char* values[3];
    strings_to_array();
  2. Replies
    39
    Views
    4,476

    Interesting situation! DBgetvalue(result, 0, 0);...

    Interesting situation!
    DBgetvalue(result, 0, 0); is actually a string (one char) but that string is number 1-4.
    So if I set retval to "-1" then I haven't check if function return's null.
    Instead I...
  3. Replies
    39
    Views
    4,476

    Mr. Lnx, 0 is default value which will be...

    Mr. Lnx, 0 is default value which will be returned if no data from database.
    Should I set it to NULL insead, or what?
  4. Replies
    39
    Views
    4,476

    Yes, yes, thank you. char* retval = 0; ...

    Yes, yes, thank you.



    char* retval = 0;


    I declared retval as int instead of char* (because of copying from other function).
    Now this work as expected.
  5. Replies
    39
    Views
    4,476

    Function of char* type

    I am still suffering with pointers.

    // main


    int index = 50;
    char* flagx = mytable_get_flag(conn, index);
    printf("flag=%s\n", flagx);
  6. Thread: Set but not used

    by nime
    Replies
    2
    Views
    14,039

    Thanks a lot, now i understand a warning. ...

    Thanks a lot, now i understand a warning.



    int myfunc(DBconn* conn, int *rmin, int *rmax)
    {
    int retval = -1;

    if ((dbtableexists(conn, mytable)) > 0)
    {
  7. Thread: Set but not used

    by nime
    Replies
    2
    Views
    14,039

    Set but not used

    This is very shortened code of my fumction:



    int myfunc(DBconn* conn, int rmin, int rmax)
    {
    rmin = 0;
    rmax = 0;
    int retval = -1;
  8. Replies
    45
    Views
    3,867

    I see, thanks migf1. I thougt it's a standard...

    I see, thanks migf1. I thougt it's a standard function since I have it without additional upgrading of my C.
  9. Replies
    45
    Views
    3,867

    When we are here, if I have to allocate and clean...

    When we are here, if I have to allocate and clean variable in main program how nobody to mention "strdup" command?
    Isn't it more elegant than do it by hand?
  10. Replies
    45
    Views
    3,867

    Barney, I do some checks at startup so I assume...

    Barney, I do some checks at startup so I assume that then things will work. If error happens it it still better than "hidden" error.
    Regarding endians and alignment, is it possible to do something...
  11. Replies
    45
    Views
    3,867

    Barney, portable to what. This works in linux...

    Barney, portable to what. This works in linux same as in windows.
    Null pointer is possible if caller ask for a record which is higher than last existed.
    Maybe I have to declare char* k = 0; at top...
  12. Replies
    45
    Views
    3,867

    I didn't want to make so wide discussion on...

    I didn't want to make so wide discussion on relatively simple question and because of that I present a simple example.
    If is really needed I can describe real situation more precisely just to let...
  13. Replies
    45
    Views
    3,867

    @Andi, I already get satisfied answer in first...

    @Andi, I already get satisfied answer in first two replies to my question what mean that question is formed correctly.

    I practic situation my char array (temp) is readen from binary file and...
  14. Replies
    45
    Views
    3,867

    Because it is part of complex project what mean...

    Because it is part of complex project what mean not suitable to post here as example.
  15. Replies
    45
    Views
    3,867

    Andi, because I have concrete situation behind...

    Andi, because I have concrete situation behind this simplified example which requires to pass a pointer.
  16. Replies
    45
    Views
    3,867

    @hk_mp5kpdw Like that? strcpy(f,...

    @hk_mp5kpdw

    Like that?


    strcpy(f, getstatus(sel));
    if (f[0] == '0' || f[0] == ' ' || f[0] == '\0')
  17. Replies
    45
    Views
    3,867

    @jimblumberg, this don't work. @rcgldr I see...

    @jimblumberg, this don't work.
    @rcgldr

    I see about that problems.
    As for now I can get data to main program like this:


    char f[2] = {0};
    strcpy(f, getstatus(5));
    ...
  18. Replies
    45
    Views
    3,867

    C beginning, transfer value by pointer

    Hello,
    I would like to clear some things regarding transfer a value by pointer among porcedures in project.

    Situation:
    In header I have declaration of function prototype:


    char*...
  19. Replies
    20
    Views
    5,973

    Sorry grumpy, I was not understand what you...

    Sorry grumpy, I was not understand what you suggest.
    Why is in this case using of static int inside this function bad?
  20. Replies
    20
    Views
    5,973

    @rcgldr What a nice idea. It works wery well,...

    @rcgldr
    What a nice idea. It works wery well, thank you!
  21. Replies
    20
    Views
    5,973

    Hi rcgldr, Yes, I'm using gcc. That way programs...

    Hi rcgldr,
    Yes, I'm using gcc. That way programs are highly portable to linux if I don't use win api, winforms and so...

    What I don't understand is that some folders have one subdir and some may...
  22. Replies
    20
    Views
    5,973

    However, it would be interesting to know under......

    However, it would be interesting to know under...


    if(S_ISDIR(stFileInfo.st_mode))
    {...


    how deep we are from initial directory, like 1, 2 or more subdirectory level....
  23. Replies
    20
    Views
    5,973

    Thank's for replies but since noone point to...

    Thank's for replies but since noone point to right direction, I have to solve a problem by myself.

    This is very simple but efficient and potrable code for recursive directory scanning for c files...
  24. Replies
    20
    Views
    5,973

    Recursive DIR problems

    Hello,
    I do recursive dir scanning for .c files in tree on linux but that one don't work on windows because of that:


    if (entry->d_type & DT_DIR)


    So I have to change code and now I have...
  25. Replies
    16
    Views
    2,616

    FINALY! Thank you Andrew! For this purpose I...

    FINALY!
    Thank you Andrew!

    For this purpose I made LEFT, MID and RIGHT functions so I can work like in VB.
    And here are how program looks now.

    int arrayOffset;
    arrayOffset = (found -...
Results 1 to 25 of 90
Page 1 of 4 1 2 3 4