Search:

Type: Posts; User: SiliconHobo

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    21
    Views
    5,222

    Okay, so this is basically how loose ends are...

    Okay, so this is basically how loose ends are tied anytime a non-void function is called? I added:
    if (fgets_ptr==NULL) return -1
    if (fgets_ptr!=NULL) return 1;

    Suppose I change the call...
  2. Replies
    160
    Views
    1,197,820

    Sticky: I'm wondering if anyone can recommend a book(s)...

    I'm wondering if anyone can recommend a book(s) on more specific aspects of C programming, like windows programming, APIs for GUIs and whatnot. Cheers.
  3. Replies
    21
    Views
    5,222

    Okay, I'm a newbie as I've said and I'm pretty...

    Okay, I'm a newbie as I've said and I'm pretty damn pleased that the prog is working the way I want it to. I'm still a long way from knowing how to optimize or maximize safety or whatever but I am...
  4. Replies
    21
    Views
    5,222

    fgets_ptr = fgets(string, size, stdin); ...

    fgets_ptr = fgets(string, size, stdin);

    Thanks. And what's that other warning about return path? What compiler are you using Elysia? It compiled clean in DevC++ 4.9.9.2.
  5. Replies
    21
    Views
    5,222

    Sweet. Thanks for your help and patience...

    Sweet. Thanks for your help and patience everyone! I finally have it working with the following code:


    void input () /* gets an entry from the...
  6. Replies
    21
    Views
    5,222

    Yeah, my original version passed the structure...

    Yeah, my original version passed the structure but I couldn't figure out how to pass different pieces of the structure without writing a different version of get_input for each array in the...
  7. Replies
    21
    Views
    5,222

    Hmmm, the structure components are all char...

    Hmmm, the structure components are all char arrays so I tried this in input:


    char *string;


    string = get_input (prompt1, 50);
    entry.name = *string;
    free...
  8. Replies
    21
    Views
    5,222

    Okay, thanks. Just to make sure I have this...

    Okay, thanks. Just to make sure I have this straight, malloc assigned variables persist globally until freed?

    I've added this line to the initialization of get_input:

    pointer = (char*)...
  9. Replies
    21
    Views
    5,222

    Can't Return/Assign Char Pointer

    Hey Folks,

    I'm getting an "incompatible types in assignment" error and warning as well as a "return makes pointer from integer without cast" warning. Yes, I'm a newb. I've been reading the...
  10. Replies
    14
    Views
    12,077

    Okay, thanks Todd and Elysia for the detailed...

    Okay, thanks Todd and Elysia for the detailed explanation. I've simplified the program and I believe my declaration, call and function now match.


    char get_input (char[26]);

    get_input...
  11. Replies
    14
    Views
    12,077

    Okay. I read them but no light bulbs are coming...

    Okay. I read them but no light bulbs are coming on atm. If I could understand the errors that would probably help. The only one I'm familiar with is the undeclared variables error but I don't see why...
  12. Replies
    14
    Views
    12,077

    Thanks for the replies. Todd: I know you gave the...

    Thanks for the replies. Todd: I know you gave the exact working code but I wanted to write my own based on what I learned from your example rather than simply copy/paste. I have now got the get_input...
  13. Replies
    14
    Views
    12,077

    Yes, only once in each run through the do-while....

    Yes, only once in each run through the do-while. Thanks. Now I only have to hit enter twice instead of 3 times :P Could it be something to do with :


    while((junk = getchar()) != '\n' && junk !=...
  14. Replies
    14
    Views
    12,077

    Hmmm, so what do I return if I want this to...

    Hmmm, so what do I return if I want this to compile and run without crashing if fgets returns NULL?

    Also, when I remove this line the code compiles but I get prompted for a name and must hit...
  15. Replies
    14
    Views
    12,077

    Troubleshooting Input Function

    Hey Folks,

    Anyone know why I'm getting an "incompatible types in return" error for :
    if (fgets_ptr == NULL) return -1; in Dev C++ 4.9.9.2?

    Even when I remove the line, the function still...
  16. Replies
    17
    Views
    3,118

    Rawk. This thread helped a lot. Thanks.

    Rawk. This thread helped a lot. Thanks.
  17. Replies
    17
    Views
    3,118

    I realize I could do it either of the other two...

    I realize I could do it either of the other two ways you suggested but I'd like to figure out what the -entry means in that line. What's an "index" in this case? I'm thinking in terms of a minus...
  18. Replies
    17
    Views
    3,118

    Yeah, that's what I was going for, thanks for...

    Yeah, that's what I was going for, thanks for fleshing it out Todd and matsp. I'm still not quite sure what this line does at the end of the do blocks in Todd's code:


    if (fgets_ptr==NULL) return...
  19. Replies
    17
    Views
    3,118

    Wowzers, thanks for the very informative replies....

    Wowzers, thanks for the very informative replies. I'm still boggling at how much this code (or something like it) increases both the size and complexity of my once innocent little prog... growing...
  20. Replies
    17
    Views
    3,118

    Okay, I just read about while((ch =...

    Okay, I just read about


    while((ch = getchar()) != '\n' && ch != EOF);

    In the recent Explanation of a Function thread and some bells are ringing. I'd still appreciate comments on my newline...
  21. Replies
    17
    Views
    3,118

    Flushing Out fflush(stdin);

    Hey folks,

    I have first concentrated on writing functional code that does what I want. However, I have read the FAQ and numerous posts about portability issues with fflush so I have now attempted...
  22. Replies
    5
    Views
    958

    Rock. Thanks foxman. That semicolon has been a...

    Rock. Thanks foxman. That semicolon has been a thorn in my side long enough.
  23. Replies
    5
    Views
    958

    Thanks for the reply. This is really stumping me....

    Thanks for the reply. This is really stumping me. I'm using Dev C++ 4.9.9.2.
  24. Replies
    5
    Views
    958

    A Simple Oversight

    Hey Folks,

    This recursive menu function is supposed to only list the options once, before menu_shown is incremented. However, the options are still being listed each time I default. Does anyone...
  25. Replies
    4
    Views
    1,160

    Thanks matsp for the fastest reply ever. I added...

    Thanks matsp for the fastest reply ever. I added another typedef line and removed the type declaration in the call to output and it works fine. Cheers.
Results 1 to 25 of 26
Page 1 of 2 1 2