Search:

Type: Posts; User: fxtdr79

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    962

    Yeah that worked. I'm sure I tried just using a...

    Yeah that worked. I'm sure I tried just using a dot initially but I guess not. Another quick question, if in the struct I had a variable 'value' which was an array of 4 ints, would that be accessed...
  2. Replies
    5
    Views
    962

    Setting values of pointers to struct

    I have a typedef struct as follows:


    typedef struct {
    float x, y, z;
    } point3d;

    Then I create the following:
  3. Replies
    5
    Views
    2,184

    Thanks for the tips guys, I managed to get it...

    Thanks for the tips guys, I managed to get it working correctly.
  4. Replies
    5
    Views
    2,184

    Typedef pointer array access question

    I have a data structure declared like this:


    typedef struct {
    double x;
    double y;
    } xyPoints;

    Then I created a pointer like this:
  5. Replies
    5
    Views
    2,782

    Thanks, that seems to be the exact issue I was...

    Thanks, that seems to be the exact issue I was wondering about.
  6. Replies
    5
    Views
    2,782

    Float variable in C acting strange

    I'm trying to do something for an assignment and we have to use a float variable. I was getting really messed up results and I couldn't figure out why so I wrote this program just to test some stuff...
  7. Replies
    15
    Views
    3,706

    I re wrote the entire program to use only fgets...

    I re wrote the entire program to use only fgets and sscanf and it works fine. Couldn't get it to work correctly with a switch statement so I changed that to if else if statements and it works fine. ...
  8. Replies
    15
    Views
    3,706

    Do you know how to correct eh fgets/sscanf code I...

    Do you know how to correct eh fgets/sscanf code I put in the top post to get it work correctly ?
  9. Replies
    15
    Views
    3,706

    If 4 valid entries aren't entered it goes into...

    If 4 valid entries aren't entered it goes into the else loop which should clear the entire input buffer since it loops around until it reaches a '\n' so I don't see how '\n' would be getting left in...
  10. Replies
    15
    Views
    3,706

    Here is more complete code: A valid entry...

    Here is more complete code:

    A valid entry would be something like: 856 John McSmith 45.76 (spaces between each item and hit enter when done).

    Invalid entries would be something like: "John...
  11. Replies
    15
    Views
    3,706

    Accepting formatted input

    I've read various google links and everyone seems to have a different way for dealing with formatted input in C and non of them seem to work for me so I'm looking for any suggestions. I want to...
  12. Those are both incorrect (for me anyways) and all...

    Those are both incorrect (for me anyways) and all give segmentation fault errors. I even tried changing char *words[] to char **words[] and I just get different errors using that.
  13. Accessing elements in an array of pointers to arrays

    I have an array of pointers that point to arrays of characters and what I'd like to do is access the 4th letter in the 3rd word and change it. I've tried tons of combinations but I can't seem to get...
  14. Replies
    4
    Views
    2,876

    realloc(): invalid size:

    I'm trying to resize an array using realloc and it's telling me that the size is invalid but I'm not sure why since I'm using sizeof to get the correct size. Any ideas?


    #include <stdio.h>...
  15. Replies
    2
    Views
    1,036

    Clearing buffer in a function

    I have something that works like this



    int main()
    {
    int currentNumber;
    int currentUnit[3];
    int checkInput;
  16. Replies
    14
    Views
    2,315

    This just goes right over my head, I'm sorry but...

    This just goes right over my head, I'm sorry but this makes no sense to me.
    while ( 1 ) // what does that even mean. How would that fit into my code, 1 is never going to change so it's never...
  17. Replies
    14
    Views
    2,315

    That's the heart of my question. How do I clean...

    That's the heart of my question. How do I clean up after the user? How can I stop the infinite loop when they enter bad input? That's EXACTLY what I'm asking you guys. How do I clean up bad input...
  18. Replies
    14
    Views
    2,315

    So the jist is no I can't use scanf I'm going to...

    So the jist is no I can't use scanf I'm going to have to use fgets and write a parser for it since I know there is going to be purposely bad formatted entries. I feel like all I do in C is code...
  19. Replies
    14
    Views
    2,315

    That's probably the problem, I don't really see...

    That's probably the problem, I don't really see why I can't use scanf to do what I want since it basically does exactly what I want except I can't clear the error when I enter hh88. Using fgets...
  20. Replies
    14
    Views
    2,315

    I was originally told to use getchar() then to...

    I was originally told to use getchar() then to use scanf() now to use fgets() so I don't know how many more inputs C has that I shouldn't be using because they don't work but I'm waiting to be told...
  21. Replies
    14
    Views
    2,315

    I have 2 issues with this the first is that from...

    I have 2 issues with this the first is that from the link you posted they say
    char *fgets(char *restrict s, int n, FILE *restrict stream); I don't want to read from a file, I want the input to be...
  22. Replies
    14
    Views
    2,315

    what to clear with clearerr() ?

    First, thanks for all the help with my other questions, learning a lot fairly quickly. I read basically when you get an error from input, the error stays until you clear it and enters an infinite...
  23. Replies
    7
    Views
    35,312

    Yeah, and if you saw the response I got it was go...

    Yeah, and if you saw the response I got it was go ask this question in a real computer forum, which is here, which is why I reposted the same question, pretty much word for word before deleting the...
  24. Replies
    7
    Views
    35,312

    Thanks, I got it working using something like...

    Thanks, I got it working using something like this



    testForEOF = scanf("%d%s", &number, unit);
    while (testFor EOF > 0)
    {
    ...
    }
  25. Replies
    7
    Views
    35,312

    While != EOF loop question

    I've written the following code and I want it to keep looping around collecting input (only asking the question once at the start) until the user uses EOF (aka ctrl+d) to "say I have no more input". ...
Results 1 to 25 of 35
Page 1 of 2 1 2