Search:

Type: Posts; User: HowardL

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thread: c program

    by HowardL
    Replies
    6
    Views
    1,430

    Try hex output to help with illustration ...

    Try hex output to help with illustration
    printf("%x %x %x %d \n", u.ch[0], u.ch[1], u.i, u.i );

    /*output:
    3 2 203 515

    Your answer lies in how data is stored in bits.
    Here's an...
  2. Regarding this part b:I have not seen that above....

    Regarding this part b:I have not seen that above. All are by address and can be incremented.

    Thoughts:
    Unlike arrays, a struct can be copied by assignment.
    When you pass an object by value a...
  3. Replies
    10
    Views
    1,283

    Out of curiosity, what could you do with that...

    Out of curiosity, what could you do with that address cast to integer?
  4. Replies
    10
    Views
    1,283

    Take a look at these warnings I get in this...

    Take a look at these warnings I get in this sample usage of what you posted:
    #include <stdio.h>
    #include <stdint.h>

    #define NUM_OF_FLASH_BLOCKS 8

    char flash_array[300 * 64];

    int main(void)...
  5. Replies
    5
    Views
    1,883

    An excel file is encoded. It would take forever...

    An excel file is encoded. It would take forever to learn decipher it. By then MS would change it (again).

    You could export all .xls to .csv (comma separated files) and write a C program to read...
  6. No offense but that is ridiculous. You did not...

    No offense but that is ridiculous. You did not even address the binary file data issue.
    Make that look just like a complete program... main() and required functions.
    Your wasting time and space.
  7. If the structs in the file are stored in binary...

    If the structs in the file are stored in binary your fgets(lista[i], 256, f) == lista[i] idea may not work out so well.
    But forget that for now. Work on your pseudo code.
    create a variable to...
  8. wow, gonna need some work. Does *p point to an...

    wow, gonna need some work.

    Does *p point to an array?
    You should probably also pass the max elements of the array as well.
    You could also use p[xxx].

    Next, you read in one chunk the size of...
  9. But the id is a single int. What happened to the...

    But the id is a single int.
    What happened to the "questions"?

    So there are many struct perg's in the file?
    anduril462's idea sounds great.

    If you need just id's then just read id's into an...
  10. Is it the op's you want to select from? How many...

    Is it the op's you want to select from?
    How many total do you have , 4?
    Well rand() a value in that range.
    Associate the value to a specific op like:

    if (x == 1) {
    printf("%s \n", ...
  11. Replies
    5
    Views
    1,032

    Right, thanks for correcting that faux pas. I...

    Right, thanks for correcting that faux pas.
    I should limited my comments on ascii.
  12. Replies
    5
    Views
    1,032

    When you say ...it's not clear. What do you...

    When you say
    ...it's not clear.

    What do you mean by? "receives a char" and "input char"
    Where EXACTLY is this coming from? ...a function parameter? ...user input? ...outer space?

    What do you...
  13. It looks like you are way ahead of yourself. Why...

    It looks like you are way ahead of yourself.
    Why don't you first learn to write the struct to a file and then read it back to the program.
  14. Replies
    1
    Views
    2,060

    puzzleWord is an array or type char right? So...

    puzzleWord is an array or type char right?
    So iterate through the array:
    char str[] = "hello world";
    int i;

    for (i=0; str[i] != '\0'; i++) {
    printf("The letter is: %c \n", str[i]);...
  15. Replies
    3
    Views
    771

    You should always check argc before trying to...

    You should always check argc before trying to access argv[1] or greater and then qualify that value before using, otherwise your program might blow up your computer.

    Re:
    termlist...
  16. Replies
    10
    Views
    1,147

    You can use the good old standard stdio.h...

    You can use the good old standard stdio.h getchar() or getc(stdin)

    instead of the windows specific conio.h getch()

    to hold the "Run" terminal open.
    Only thing is you have to hit "ENTER"...
  17. Replies
    10
    Views
    1,257

    Oh, I see the linker problem was because the gcc...

    Oh, I see the linker problem was because the gcc input filename extension was ,cpp. So I simply changed to .c.

    So now I can run. Interestingly though, with the "for" condition left at:
    pthread_t...
  18. Replies
    10
    Views
    1,257

    Oh yeah! (void*) IS an object! duh Last night I...

    Oh yeah! (void*) IS an object! duh
    Last night I was thinking (void), (void*) what's the difference? They're both nothing...:)
    Oops so now there is an unused parameter, and how about this linker...
  19. Replies
    10
    Views
    1,257

    Gosh, I get an error on that "if" line , but I...

    Gosh, I get an error on that "if" line , but I don't know why?

    > gcc -Wall -W -pedantic 20111104-pthread.cpp -l pthread -o 20111104-pthread.bin
    20111104-pthread.cpp: In function ‘void...
  20. Replies
    8
    Views
    1,791

    Don't know if it's just a miscopy to the post but...

    Don't know if it's just a miscopy to the post but using g++:

    // In main.cpp
    usingnamespacestd; //gets error - in that cout and endl are not found.
    return0; // gets error - undifined...
  21. Replies
    8
    Views
    1,791

    Well to incorporate the function you need to call...

    Well to incorporate the function you need to call it, maybe something like this:
    int main() {
    char s1[] = "hello";

    int len = stringLen(s1); // wouldn't this make sense?

    return 0;...
  22. Replies
    15
    Views
    2,433

    Try sticking this in there and running it. ...

    Try sticking this in there and running it.
    ~Quiz() { cout << "Bye Bye" << endl; }
    Also main() score is not the same as class Quiz score.
  23. Replies
    7
    Views
    2,687

    Don't know but could the problem be that you...

    Don't know but could the problem be that you simply need to put the macro into context? eg:
    #include <stdio.h>

    #define JPDM_NAME_SIZE 16

    #define JPDM_DECLARE_BUFFER_DESCRIPTION(name, ptr,...
  24. Replies
    7
    Views
    3,079

    If your really having trouble with something ...

    If your really having trouble with something take the time to isolate and experiment with the suspects:
    #include <stdio.h>

    int main(void)
    {
    int scores[2][2] = { {1, 2}, {3, 4} };

    /*...
  25. Replies
    11
    Views
    2,872

    oops, I see what you're saying. Real sorry to...

    oops, I see what you're saying. Real sorry to post a bad example.
    Thanks for straightening me out on those things.
    Sometime I might start retaining some of this for more than a day... or maybe...
Results 1 to 25 of 72
Page 1 of 3 1 2 3