Thread: Still having a little trouble w/th ptrs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Registered User
    Join Date
    May 2003
    Posts
    38
    Cheeers. I just ran it under cygwin and its running fine. I think its just that I was still using fwrite. Just means I have to have a read on fprintf again. Thank you so much for the help. Now that thats done, the uncompression shouldnt be too hard.
    Thanks again,
    Johannes

    PS: Would this work? At the moment its complaining bout the strncpy use.
    Code:
    char * strcompare( char *ptrstr, char *ptroldstr )
    {
       int i;
       char * temp;
    
       temp = malloc ( 80 * sizeof *temp);
      
       if( strlen( ptroldstr ) == 0 )
       {
           strcpy(ptroldstr,ptrstr);
           return 0;
       }
       for( i = 0; i < strlen( ptrstr ); ++i)
       {
          if( isdigit( *( ptrstr + i ) ) != 0 )
          {
             if( *( ptrstr + i ) == '0' )
             {
                temp = strstr( ptrstr, "0" );
                strcpy( ptrstr, temp );
             }
    
             strncpy( ptrstr, *( ptrstr + i ), strlen( ptrstr ) );
          } 
          
       }
    
       strcpy( ptroldstr, &ptrstr[ i ] );
       return ptrstr;
    }
    It wouldnt let me attach the file so I accidentaly started a new thread. The file and another question is under "slightly got lost and confused".Sorry, I know you probably have better things to do but I really appreciate all the help. May be one day I understand enough to be of help to others too.
    Cheers, Johannes

    "You gotta hate programming to love it. The more you hate it the more you love it!"
    Last edited by Yourhighness; 05-18-2003 at 06:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with assignment in C
    By mohanlon in forum C Programming
    Replies: 17
    Last Post: 06-23-2009, 10:44 AM
  2. struct ptrs to struct ptrs
    By lolguy in forum C Programming
    Replies: 5
    Last Post: 02-24-2009, 12:02 AM
  3. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  4. trouble scanning in... and link listing
    By panfilero in forum C Programming
    Replies: 14
    Last Post: 11-21-2005, 12:58 PM
  5. C++ program trouble
    By senrab in forum C++ Programming
    Replies: 7
    Last Post: 04-29-2003, 11:55 PM