Search:

Type: Posts; User: jamie85

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    3,495

    Works fine for me. int mapdist[10][10] =...

    Works fine for me.



    int mapdist[10][10] = {

    {0,4,5,6,7,8,9,8,7,6},
    {2,0,4,5,6,7,8,9,8,7},
    {1,2,0,4,5,6,7,8,9,8},
    {2,3,4,0,6,7,8,9,8,7},
  2. Replies
    15
    Views
    9,680

    You would think. However out lecturer hates...

    You would think. However out lecturer hates strtok with a passion.
  3. pre-defined array of strings within a structure

    Why is the following syntax not legal?


    struct additives {
    char* milk[7]; = { "Skimmed", "Frothy", "half-skim", "Cream" };
    };
  4. Replies
    3
    Views
    2,668

    You can use a pointer to step along each...

    You can use a pointer to step along each character in the string, and then compare what the pointer is pointing at with ' " '.
  5. Replies
    7
    Views
    2,712

    Works for me. Except the fact that your loop...

    Works for me.

    Except the fact that your loop will not terminate when it hits the end of your string.
  6. Replies
    7
    Views
    2,712

    Setup a char pointer to your string, and then use...

    Setup a char pointer to your string, and then use


    isspace()

    to determine whether you are pointing at white space or not.

    Then either move the pointer along to the next element, or add the...
  7. Replies
    2
    Views
    2,859

    strip_newline() is declared as a void, however...

    strip_newline() is declared as a void, however your using return.

    Try declaring the function as an int, and see where you get from there.
  8. Replies
    6
    Views
    3,463

    /* if both strings have leading '.'s */ return...

    /* if both strings have leading '.'s */
    return strcmp( &((char *)name1)[1], &((char *)name2)[1]);



    No need for copying.

    And just use conditions similar to Salems to determine what you need...
  9. Replies
    9
    Views
    3,297

    You declare main as an int, but you dont return...

    You declare main as an int, but you dont return anything at the end of the function.



    try this


    float array[12];
  10. Replies
    7
    Views
    4,407

    Thanks salem very helpful of you

    Thanks salem very helpful of you
  11. Replies
    7
    Views
    4,407

    cheers Ancient Dragon nice tip. int...

    cheers Ancient Dragon nice tip.






    int qsort_contents(const void* name1, const void* name2)
    {
    /* check the first file names first characted so we know if we need
  12. Replies
    7
    Views
    4,407

    malloced 2d array passed to qsort

    I have the following code to add directory contents to a malloc'ed array of pointers to arrays.

    However, after passing the 2d array to qsort, qsort returns nothing in the array.

    array here =...
  13. Replies
    4
    Views
    3,761

    I was using fgets however i had this little piece...

    I was using fgets however i had this little piece of code



    p = strchr(linebuf, '\n');

    if (p)
    *p = '\0';
  14. Replies
    4
    Views
    3,761

    #define MAXLINELEN 4096 char...

    #define MAXLINELEN 4096


    char linebuf[MAXLINELEN];

    FILE *history_stream;

    if ( ( history_stream = fopen("history.txt", "a+") ) == NULL )
    {
    perror("Bash");
  15. Replies
    4
    Views
    3,761

    fputs only write first part of string

    I am using fputs like so




    strcat(linebuf, "\n");
    fputs(linebuf, history_stream);
  16. Segmentation fault. passing extra parameters to function

    I have a function declared like so:


    int func( int file_num, int a, int l, int g );


    I decided to change this so it could accept another parameter:


    int func( int file_num, int a, int l,...
  17. Replies
    7
    Views
    5,383

    Thankyou thankyou. Works a like a dream now. Good...

    Thankyou thankyou. Works a like a dream now. Good FAQ also.

    Cheers.
  18. Replies
    7
    Views
    5,383

    passing/pointing to a 2d array

    I have a 2d array as so:


    char array[num_of_files][100];

    and a pointer


    char* p;
  19. Replies
    5
    Views
    4,135

    " warnings:'loop' has not been used-line 34 &...

    " warnings:'loop' has not been used-line 34 & 153."

    This is because you dont use the variable loop in those functions.
  20. Replies
    2
    Views
    2,311

    When to create a header file?

    When would you create a header file?

    Im guessing its for storing functions you would use in more than 1 program?
  21. Replies
    11
    Views
    250,311

    ... while ( *ai_mode != FOLLOW_LINE ) {...

    ...
    while ( *ai_mode != FOLLOW_LINE )
    {
    printf("\n\njoymode\n\n");

    move_motors_with_stick(device, subdevice_an_zero, subdevice_an_one, x_scale, y_scale, x_min_read, y_min_read,...
  22. Replies
    11
    Views
    250,311

    Cant seem to implement either of those examples....

    Cant seem to implement either of those examples.


    changemode(1);

    if( kbhit() )
    {
    ch = getchar();
    printf("\nGot %c\n", ch);
  23. Replies
    11
    Views
    250,311

    Im considering that now seeing as im using curses...

    Im considering that now seeing as im using curses throughtout my program anyway.

    Thats for the code guys.
  24. Replies
    11
    Views
    250,311

    kbhit() for linux.

    I only want the program to quit if the user has hit a key and that key corresponds to the ESC key. Otherwise i want it to continue looping.

    This is easlily done in windows(shows below), but is...
  25. Thread: ncurses bkgd()

    by jamie85
    Replies
    1
    Views
    3,310

    ncurses bkgd()

    Anybody know how to use this function?

    Ive been messing with it a little and ended up with a red background for the terminal, and green hashes everywhere. heh.

    thanks
Results 1 to 25 of 67
Page 1 of 3 1 2 3