Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: srand(time(NULL)) error message

  1. #11
    Join Date
    Jun 2010
    Beans
    92

    Re: error in fprintf: should be struct

    try changing


    fprintf( OUTD , "%s" , SPARAM[ i ] );

    to

    fprintf( OUTD , "%s" , (char *)(SPARAM+i) );

  2. #12
    Join Date
    Dec 2011
    Beans
    51

    Fixed and finished

    Thank you! I'm always very grateful for the help I get here.

    I'm VERY happy to get this code working.

  3. #13
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,037
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: error in fprintf: should be struct

    Quote Originally Posted by xb12x View Post
    try changing


    fprintf( OUTD , "%s" , SPARAM[ i ] );

    to

    fprintf( OUTD , "%s" , (char *)(SPARAM+i) );
    In my opinion, it is better to avoid casting in C as much as possible. I would regard the following as much cleaner.
    Code:
    fprintf( OUTD , "%s" , SPARAM[i].word );

  4. #14
    Join Date
    Dec 2011
    Beans
    51

    Re: srand(time(NULL)) error message

    This works better because the fonts in the output file are better now. The previous command produced computer garbage for those few words, even though the code ran through smoothly. I wasn't too worried (because I knew what the words were), but the fonts at output are perfect now.
    Code:
    fprintf( OUTD , "%s" , SPARAM[i].word );
    Thank you.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •