Hi guys:
I am trying to fix compiler warnings on classicladder v7.124.
In the file.c source there is a warning: ISO C90 forbids mixed declarations
and code. Of course if I just change the order of the code to stop the error
it changes the info that the function fgets is passed. Please see the code
below, I put '->' in front of the lines I'm talking about. What is the right
way to fix this? ( I'm kinda betting the whole function would need to be
rewritten).
Thanks Chris Morley
char *cl_fgets(char *s, int size, FILE *stream)
{
-> s[0] = '\0';
-> char * res = fgets( s, size, stream );
//s[0] = '\0' //can't move it here!
// While last character in string is either CR or LF, remove.
while (strlen(s)>=1 && ((s[strlen(s)-1]=='\r') ||
(s[strlen(s)-1]=='\n')))
s[strlen(s)-1] = '\0';
if ( strlen( S_LINE )>0 && strlen(s)>strlen( S_LINE )+strlen( E_LINE ) )
{
strcpy( s, s+strlen( S_LINE ) );
s[ strlen(s)-strlen(E_LINE) ] = '\0';
}
return res;
}
_________________________________________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers