Search:

Type: Posts; User: WoodSTokk

Page 1 of 15 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    13
    Views
    9,501

    Little bit late, but you should check if the...

    Little bit late, but you should check if the files are realy opened before you use it.



    FILE *fp = NULL, *outfile = NULL;

    if ((fp = fopen("be.txt", "r")) == NULL) {
    ...
  2. Replies
    21
    Views
    6,130

    Please don't use fflush(stdin) !!! I know that...

    Please don't use fflush(stdin) !!!
    I know that Microsoft has extend the function that is also usable for stdin, but this is only valid an OSes from Microsoft!
    We discuss in this forum the language...
  3. Replies
    28
    Views
    7,696

    Undefined Behavior! You return a pointer to...

    Undefined Behavior! You return a pointer to 'text', but 'text' is a local variable inside the function 'eingabe'.
    At the time the function returns, the variable (and its space in memory) become...
  4. Replies
    9
    Views
    4,359

    And your comparisons are in real assignments....

    And your comparisons are in real assignments.
    '=' != '=='
  5. Replies
    5
    Views
    1,332

    Line 14 has also a error printf("Number of...

    Line 14 has also a error


    printf("Number of vowels: %d\n", sentence);

    I think it should be


    printf("Number of vowels: %d\n", vowels);
  6. Replies
    8
    Views
    1,251

    strcpy(tmp, string1 + position); Simply...

    strcpy(tmp, string1 + position);


    Simply Pointer Arithmetic.


    string1 is a array of characters.
    If you use the name of a array without index, it returns the address to the first member of...
  7. Replies
    6
    Views
    1,863

    Definitions of struct and typedef should go in...

    Definitions of struct and typedef should go in global scope.
    You miss the name of your typedef.


    // declare a struct and typedef in two steps
    struct account_s
    {
    int profile_number;
    ...
  8. Replies
    13
    Views
    2,183

    Ops, sorry, should be char...

    Ops, sorry, should be


    char ConvertedToString[] = "This is a test string!\n";
  9. Replies
    13
    Views
    2,183

    I asume that AllocatedString is declared as char...

    I asume that AllocatedString is declared as char pointer like:


    char *AllocatedString = NULL;

    Now, whats the size of AllocatedString?
    Secondly, don't cast the returned value of malloc.
    The...
  10. Replies
    13
    Views
    2,183

    Same problem here. int_8 has the same size as...

    Same problem here. int_8 has the same size as char. EOF will not fit in there.
    Here is a solution with int (and a little bit shorter):


    void PressEnter(void)
    {
    int EnterBuffer;
    ...
  11. Replies
    13
    Views
    2,183

    As GReaper says, it's implementation-defined. ...

    As GReaper says, it's implementation-defined.

    Anyway, EOF is defined as a int and is larger then a char.
    If you assign EOF to a char, it will be stipped down to 8 bit.
    Now, it represent the char...
  12. Replies
    13
    Views
    2,183

    Additional what whiteflags says. ...

    Additional what whiteflags says.


    if(CharacterInput[ProgramCounter] == '\n' || CharacterInput[ProgramCounter] == EOF)
    break;

    CharacterInput is a array of chars. EOF is an integer and can...
  13. I never have programmed for Arduino, but this...

    I never have programmed for Arduino, but this should work.
    It shows also how a function return a value, so you don't need global variables.



    uint32_t readADS1231(void)
    {
    uint32_t...
  14. No problem, You are welcome. I have started to...

    No problem, You are welcome.
    I have started to think that my wording was incorrect, because I am not a nativ english speaker. ;)
  15. Where have I told you that this is wrong??? ...

    Where have I told you that this is wrong???





    I dont know where you find a contradiction. Both examples uses 'fgetc' and both assign the returned value to a int-variable.
    BTW, you should...
  16. Replies
    3
    Views
    2,078

    Hmmm, so if you calculate the day of 10th of...

    Hmmm, so if you calculate the day of 10th of February (month == 2), you add one day if the year is a leap year.
    So 10th of Feb is normaly day 41, but in a leap year it is day 42?
    And 1st of March?...
  17. The difference is: 'fgetc' return 'EOF' if there...

    The difference is:
    'fgetc' return 'EOF' if there was no character left to read.
    'feof' return a value that will be interpreted as 'true' if the eof-flag of the stream is set.
    But the eof-flag will...
  18. 'c' is a variable and return nothing. It can only...

    'c' is a variable and return nothing. It can only represent a value according to the type.
    The function 'fgetc' return a value of type int. This means, the variable you assign the returned value...
  19. 'c' is a variable and return nothing. It can only...

    'c' is a variable and return nothing. It can only represent a value according to the type.
    The function 'fgetc' return a value of type int. This means, the variable you assign the returned value...
  20. Replies
    3
    Views
    2,078

    You should check the input from user. … int...

    You should check the input from user.



    int days_per_month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};


    // after the user entered the input in main

    // check year
  21. Your comparition will allways be true, because...

    Your comparition will allways be true, because 'c' can't represent EOF.
    Look at fgetc - C++ Reference
    The function 'fgetc' returns a 'int'.
    This means you should declare 'c' as 'int'.
  22. Replies
    6
    Views
    6,239

    Your compiler should warn you about the...

    Your compiler should warn you about the print_list() function.
    The printf() inside the function has to less arguments.
    I have also edited the arguments itself to use the arrow-operator.



    void...
  23. The quoted line from Horror is from the fflush...

    You pulled that out of your ass. Windows works that way, but linux doesn't.
    [/QUOTE]
    The quoted line from Horror is from the fflush man-page of linux.
    But this doesn't mean stdin, because stdin...
  24. The system doesn't matter. C is OS independent!...

    The system doesn't matter. C is OS independent! Every beginner should learn programming with the C-Standard in mind.
    You can also learn features that some OSes add on top of the C-Standard, but then...
  25. NO! Never use fflush() on streams that was open...

    NO! Never use fflush() on streams that was open for input or input/output where the last operation was input!
    Only use fflush() on streams that was open for output or input/output where the last...
Results 1 to 25 of 367
Page 1 of 15 1 2 3 4