length_of_my_string+1
From: Clunixchit (chitlesh_at_gmail-dot-com.no-spam.invalid)
Date: 05/31/05
- Next message: Måns Rullgård: "Re: length_of_my_string+1"
- Previous message: Nix: "Re: Process memory layout"
- Next in thread: Måns Rullgård: "Re: length_of_my_string+1"
- Reply: Måns Rullgård: "Re: length_of_my_string+1"
- Reply: Clunixchit: "re:length_of_my_string+1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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);
- Next message: Måns Rullgård: "Re: length_of_my_string+1"
- Previous message: Nix: "Re: Process memory layout"
- Next in thread: Måns Rullgård: "Re: length_of_my_string+1"
- Reply: Måns Rullgård: "Re: length_of_my_string+1"
- Reply: Clunixchit: "re:length_of_my_string+1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]