Search:

Type: Posts; User: towed

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    891

    The purpose is to simply to generate...

    The purpose is to simply to generate psuedo-random numbers using time like I am doing. That is it. Nothing more. Regardless of what I am doing with the result -- it is part of a bigger project. This...
  2. Replies
    8
    Views
    891

    A good "pseudo" random function? Critique?

    Will this generate psuedo random numbers efficiently?

    Idea: I want it to cycle through a user defined number of numbers (n_total) for as long as it takes to reach a set criteria of numbers that...
  3. Replies
    9
    Views
    1,127

    Yeah I get -20... But how can I get 340? That is...

    Yeah I get -20... But how can I get 340? That is the right answer (i.e., from google).
  4. Replies
    9
    Views
    1,127

    Modulus problem...

    Problem with Modulus

    I am doing fmod(-20, 360) and not getting the correct answer (340).



    #include <math.h>
    #include <stdlib.h>
    #include <stdio.h>
  5. Linear interpolation with boundary issue problem...

    Hello,

    I am trying to write some code to do a linear interpolation scheme along an 360 element array (so 0 - 359 elements with each element representing a degree, aka like on a compass). I have...
  6. Replies
    6
    Views
    2,106

    Very interesting site... I see the use of...

    Very interesting site... I see the use of "rand()/((double)RAND_MAX + 1)" there...


    No biggie... its not my full code, as that in itself is very long...



    That is what I meant, sorry!
  7. Replies
    6
    Views
    2,106

    Well, I will be running it for multiple cases and...

    Well, I will be running it for multiple cases and want different lists. Thus, seeding the PRNG (psuedo-random number generator I assume you are referring to) with time. Its just that, although the...
  8. Replies
    6
    Views
    2,106

    so pass iseed in instead of doing it in the...

    so pass iseed in instead of doing it in the function?
    any reason why it is bad to seed it in the function?
  9. Replies
    6
    Views
    2,106

    C random number generator function...

    I have made a function that generates a random number and, from that number, pulls a name from a list if criteria is met. BUT, I am questioning its capability. I know with computers, the numbers...
  10. Replies
    3
    Views
    791

    Yes... That's one of the reasons I said foolish...

    Yes... That's one of the reasons I said foolish :P...

    Ughh...

    Check with:
    if(file == NULL) printf("fail");

    ?
  11. Replies
    3
    Views
    791

    Cause of a seg fault (core dumped)

    Im running a program that takes several days to run and think I know the cause... I didnt run it in gdb so I have no idea exactly besides a hint at where it is. Is this a possible cause?

    Looking...
  12. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    How can strlen(ptr_str)+1 become 0. Doesn't...

    How can strlen(ptr_str)+1 become 0. Doesn't strlen have to be positive?
  13. Replies
    3
    Views
    2,874

    tag

    tag.
  14. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Well the aforementioned freeing seems like it...

    Well the aforementioned freeing seems like it worked, given that it now has passed that point in the program. Thanks tabstop :)... I think I learned a thing or two with this discussion.
  15. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Yeah, I have it print strlen() when it fails and...

    Yeah, I have it print strlen() when it fails and it returned 3. So, I THINK it is safe to say its memory leak or not enough being present. Could it be that conclusive (in regard to the diagnoses).
  16. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Interesting... Sadly, I never thought this...

    Interesting... Sadly, I never thought this could/would occurred. I always (that I remember) am freeing memory after every malloc (including in this function since it is called MANY times. Which...
  17. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Testing for the error message w/ ...

    Testing for the error message w/




    wx_second = malloc(strlen(ptr_str) + 1);

    if(wx_second == NULL){
    printf("** Error in...
  18. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    (gdb) down #2 0x08053734 in madis_wx_intensity...

    (gdb) down
    #2 0x08053734 in madis_wx_intensity (pres_weath=0x81163bb "-RA", ' ' <repeats 21 times>, auto_stn_type=0x813ddb2 " ", pass=1, precip1=0x2d,
    precip2=0x2d, precip3=0x2d,...
  19. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    2623 is the strcpy()... Sorry, I don't what...

    2623 is the strcpy()...

    Sorry, I don't what you mean by "missing line".
  20. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Ok, I did that and got: (gdb) up #1 ...

    Ok, I did that and got:


    (gdb) up
    #1 0x00000000 in ?? ()
    (gdb) up
    #2 0x08053734 in madis_wx_intensity (pres_weath=0x81163bb "-RA", ' ' <repeats 21 times>, auto_stn_type=0x813ddb2 " ",...
  21. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    Hmm, well -g is an option at least.

    Hmm, well -g is an option at least.
  22. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    #0 0x881663f0 in strcpy () from /lib/libc.so.6...

    #0 0x881663f0 in strcpy () from /lib/libc.so.6
    #1 0x00000000 in ?? ()
    #2 0x08053734 in madis_wx_intensity (pres_weath=0x81163bb "-RA", ' ' <repeats 21 times>, auto_stn_type=0x813ddb2 " ",...
  23. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    IF it is non-writable memory, anyway to fix it?...

    IF it is non-writable memory, anyway to fix it? Get more memory in my heap (I use malloc() so it isn't my stack, correct?... or I believe).

    Note, It's weird as I modified this function before and...
  24. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    In regards to 2, that is so weird. As before...

    In regards to 2, that is so weird. As before that step I check the what is pass for NULL via:



    char *ptr;

    ...


    ptr = strstr(string, wx_element);
  25. Thread: gdb/C question

    by towed
    Replies
    27
    Views
    2,548

    so you have to compile with -g to get it? It...

    so you have to compile with -g to get it? It doesn't just add it when using gdb? I use -Wall...
Results 1 to 25 of 85
Page 1 of 4 1 2 3 4