length_of_my_string+1

From: Clunixchit (chitlesh_at_gmail-dot-com.no-spam.invalid)
Date: 05/31/05


Date: Tue, 31 May 2005 16:17:08 +0000 (UTC)

my problem is quite simple;
with printf("%d %s",strlen(tmp),tmp[i]);
im getting length_of_my_string+1
i.e if it reads "ls" from the file, it prints 3 instead of 2;
any solution?

        char tmp[nLINES][LINE_LENGTH];
                
        FILE *stream = fopen( config_file , "r" );
        if ( stream == NULL ) {
                fprintf (stdout , "fopen %s failed" , *config_file
);
                return;
        }
        
        while( (int *) fgets( tmp[i] , LINE_LENGTH ,
stream ) != NULL ){ printf("%d
%s",strlen(tmp[i]),tmp[i]);
                i++;
        }
        fclose (stream);