Search:

Type: Posts; User: dunsta

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Solved #include...

    Solved



    #include<stdio.h>
    #include<stdlib.h>
    #include<signal.h>
    #include<curses.h>

    void func_handler(void)
  2. after exit(1) from curses program, terminal has no text

    Hi cprogramming,
    I have a program where
    1. the user can choose to display an ascii pic from three options
    2. the pic displays in a curses window for, say 10 seconds (10 is a cmd line arg)
    3.the...
  3. Replies
    2
    Views
    919

    thanks

    thanks
  4. Replies
    2
    Views
    919

    return random from its own function

    Hello again,
    I have this program that works fine

    #include<stdio.h>
    #include<time.h>
    int main(void)
    {
    srand(time(NULL));
    int x,i;
    for(i=0;i<10;i++)
  5. Replies
    3
    Views
    5,697

    I am using Xcode I uncommented the destructor...

    I am using Xcode

    I uncommented the destructor declearation in the class Nation


    ~Nation();


    and added a destructor definition
  6. Replies
    3
    Views
    5,697

    error : pointer being freed not allocated

    I have typed this code from a book after learning about classes/objects in c++.
    It runs until the user enters name for player 1, but then the error
    "Conquest game classes objects(491) malloc: ***...
  7. Thread: calloc

    by dunsta
    Replies
    5
    Views
    3,483

    Yes, oldmem was taken from the test program...

    Yes, oldmem was taken from the test program (testing calloc/realloc), but isn't needed in this one.

    You are right in that the program the quoted text was referring to was using "gets", well...
  8. Thread: calloc

    by dunsta
    Replies
    5
    Views
    3,483

    would you mind telling me if I am using...

    would you mind telling me if I am using calloc/realloc correctly.
    I am trying to add more memory each time a user adds a new entry.



    #include <stdio.h>
    #include<string.h>
    #include <stdlib.h>...
  9. Thread: calloc

    by dunsta
    Replies
    5
    Views
    3,483

    Ok, for some reason I thought malloc/calloc...

    Ok, for some reason I thought malloc/calloc assigned only a block size you requested, and wouldn't let the program go over. I was very wrong.
    The book I am learning from states "this program allows...
  10. Thread: calloc

    by dunsta
    Replies
    5
    Views
    3,483

    calloc

    I am writing this program and using calloc. My next step is to add realloc for every new entry added.
    But i do not understand why when I set


    ent1 = (ent *)calloc(1, sizeof(ent));

    this, if I...
  11. Replies
    3
    Views
    1,494

    sorry I meant to type if(name[x] !='\0')

    sorry I meant to type

    if(name[x] !='\0')
  12. Replies
    3
    Views
    1,494

    ok, i tried if(name[x] !=0) inside the for...

    ok,

    i tried if(name[x] !=0)
    inside the for loop, and it seems to work fine.
    I am still unsure as to why the while loop wouldn't work though.
  13. Replies
    3
    Views
    1,494

    count how many elements used in calloc

    I am trying to count how many characters in a name.
    i assume that:
    1. one element in the calloc memory is = one char.
    2. I am using x<20 properly in the 'for' loop, because size of char = 1, and...
  14. Replies
    3
    Views
    3,451

    rats! ok, thanks. :)

    rats!

    ok, thanks. :)
  15. Replies
    3
    Views
    3,451

    string compare “EXC_BAD_ACCESS”.

    this code


    #include <stdio.h>
    #include <string.h>

    int main(){
    char *str1 = "A";
    char *str2 = "A";
    char *str3 = "!";
  16. Replies
    18
    Views
    9,370

    I'm guessing that it would be a getchar() (which...

    I'm guessing that it would be a getchar() (which means waiting for the user to hit enter?) because after the first loop we put that into scrap. And, I shouldn't have had it there twice (novice...
  17. Replies
    18
    Views
    9,370

    I entered the scrap newline loop after the user...

    I entered the scrap newline loop after the user enters the 3 answers, but sometimes the "Would you like..." appears only once on the first iteration, but then runs through twice after selecting a new...
  18. Replies
    18
    Views
    9,370

    I tried to understand the article as best as I...

    I tried to understand the article as best as I could, but some of it is a bit over my head at the moment. The code I thought might help, didn't. I assume I am using it wrong, or I'm way off. But I...
  19. Replies
    18
    Views
    9,370

    now after I have added a loop, the program runs...

    now after I have added a loop, the program runs once, but then after the loop, runs twice, then waits for user input?



    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>

    int main(){...
  20. Replies
    18
    Views
    9,370

    oh man! :( Thanks :)

    oh man!

    :(

    Thanks

    :)
  21. Replies
    18
    Views
    9,370

    I retyped the program and can't figure out why,...

    I retyped the program and can't figure out why, after the user enters the 3 numbers and hits (enter) key, I get a windows error message pop-up

    "Concentration game.exe has encountered a problem and...
  22. Replies
    18
    Views
    9,370

    So fflush(stdout); - clears the output buffer ...

    So fflush(stdout); - clears the output buffer and ensures the output is printed to the screen asap?

    Now the time countdown works (output stays on screen for about 3 seconds) before the "clear"...
  23. Replies
    18
    Views
    9,370

    cheers Salem

    cheers Salem
  24. Replies
    18
    Views
    9,370

    how to clear screen after short pause

    When I run this program the numbers are supposed to display for a short time before screen clears. However the 'short pause' seems to happen before the numbers are displayed, then screen clears as...
  25. Replies
    13
    Views
    4,261

    Oh yes, very interesting, Thank you Elysia.

    Oh yes, very interesting, Thank you Elysia.
Results 1 to 25 of 51
Page 1 of 3 1 2 3