Search:

Type: Posts; User: ImageJPEG

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thanks to OCD, I programed a new line remover for text files. Needs some work still.

    So I've replaced '\r' and '\n' with '\0'. This, however, just fills up the file with 0s instead of just removing the contents all together. I would like to just fill the '\n' with nothing, not even...
  2. Got it. Sorry, I'm difficult sometimes. :/ ...

    Got it.

    Sorry, I'm difficult sometimes. :/



    //
    // main.c
    // number_guess
    //
  3. For example, if I place 10000 inside of the...

    For example, if I place 10000 inside of the buffer, it's fully populated because of '\n' at the end.

    This isn't happening though for whatever reason.
  4. Why is fgets not fully populating its buffer?

    Any ideas? I can't execute the clear buffer instruction because fgets never fully populates its buffer. If I execute the clear buffer functions before fgets populates its buffer, the clear buffer...
  5. Replies
    10
    Views
    10,265

    Also, so I don't have to keep posting my modified...

    Also, so I don't have to keep posting my modified code:

    GitHub - e14tech/number_guess: A random number guessing game
  6. Replies
    10
    Views
    10,265

    Wow, I feel really dumb not using return 1 :/

    Wow, I feel really dumb not using return 1 :/
  7. Replies
    10
    Views
    10,265

    Like this: 15322

    Like this:

    15322
  8. Replies
    10
    Views
    10,265

    Also, I know using goto is frowned upon but I've...

    Also, I know using goto is frowned upon but I've read where situations like nested loops are acceptable.
  9. Replies
    10
    Views
    10,265

    I'll have to give that a shot. IIRC, if you...

    I'll have to give that a shot.

    IIRC, if you use fgets and stdin goes over the fgets buffer, the excess characters stay in stdin and are read when another call to fgets is executed.

    That's why...
  10. Replies
    10
    Views
    10,265

    Stuck on clearing the input buffer

    I'm using the while((c = getchar()) != '\n' && c != EOF); method but if it's called, it goes into an infinite loop.

    If the character array goes over 10, including '\n', it gets stuck in an...
  11. Replies
    8
    Views
    1,464

    I've been doing a bit more work with it. It seems...

    I've been doing a bit more work with it. It seems to be fully working.

    And for full context, this will force a user to enter a number. If the user enters a series of numbers but adds a non-integer...
  12. Replies
    8
    Views
    1,464

    And sorry, I should have provided more context. I...

    And sorry, I should have provided more context. I am printing the index locations of found numbers to help me figure out if it's working or not.
  13. Replies
    8
    Views
    1,464

    When you say convert the input to an integer, do...

    When you say convert the input to an integer, do you mean instead of "char UserInput[64];" I use "int UserInput[64];"?
  14. Replies
    8
    Views
    1,464

    Right now, it just reports back where a number is...

    Right now, it just reports back where a number is located within the UserInput array.

    AFAIK, isdigit only works on int types. I'm taking input as chars.

    The way my code is right now, if I used...
  15. Replies
    4
    Views
    6,258

    DOS C compiler on DOSBox maybe? Install Turbo...

    DOS C compiler on DOSBox maybe?

    Install Turbo C++ Compiler on 64-bit Windows 7 Using DosBox - techinfoBiT

    ibiblio.org FreeDOS Group -- Development

    IMO, go after the stuff listed in the...
  16. Replies
    8
    Views
    1,464

    Function to detect numbers, WIP.

    I'm developing a function to determine if a user has entered a number or characters.

    Here's the code for that:



    #include <stdio.h>
    #include <string.h>
    #include <stdint.h>
  17. Replies
    1
    Views
    2,510

    Reading another book on C

    It’s “C Programming” by Wikibooks on iBooks.

    I’m currently reading on math.h

    I was horrible in math, worse in algebra in high school, I’m just as bad today almost 10 years later.
    ...
  18. Replies
    5
    Views
    4,227

    Are you able to tell me some of the functions...

    Are you able to tell me some of the functions used in your function without giving away how it works?
  19. Replies
    5
    Views
    4,227

    I've done a bit more work. This time I can accept...

    I've done a bit more work. This time I can accept characters (except for the looper variable, haven't done that yet). My goal is to just reject anything that's not a number. I'll get there.

    Here's...
  20. Replies
    5
    Views
    4,227

    Random number guessing game

    I'm on my way to make a Hang Man game so I thought I'd develop a random number guessing game first.

    Here's the code:



    #include <stdio.h>
    #include <time.h>
    #include <stdlib.h>
  21. Oh, I was thinking it worked similar to getc...

    Oh, I was thinking it worked similar to getc where it grabs the next character each time the loop is iterated.

    So it's just a matter if adding:



    if(ep == NULL)
    break;
  22. Wouldn't dp have to become null to give ep a null...

    Wouldn't dp have to become null to give ep a null value? If that's the case, wouldn't the while loop terminate itself since it depends on dp != NULL?
  23. For your error output, I would recommend either...

    For your error output, I would recommend either perror("enter your msg here\n") or fprintf(stderr, "enter your msg here\n")

    Another recommendation would be to rename your variables into something...
  24. Oh, and this is from GNU's own site The GNU C...

    Oh, and this is from GNU's own site

    The GNU C Library: Simple Directory Lister
  25. Wouldn't this be against convention or something?

    I've been looking at some code to print out the current directory the executable is located.

    Here's GNU's code for a simple directory listing program:



    #include <stdio.h>
    #include...
Results 1 to 25 of 96
Page 1 of 4 1 2 3 4