I'm not sure, but doesn'tit require some prior initialization?
Compilers find it easier to use a code when they find some declarations just
preceding the actual code.
in some cases (in asm) I use two types of routines, ones with autoincrement
and ones without, so that one can precede data entry with a read.
in your case it woud go like the code below, but I have no clue what it does
;(
-> char * res = fgets( s, size, stream );
-> s[0] = '\0';
-> char * res = fgets( s, size, stream );
On 2/9/08, Chris Morley <[EMAIL PROTECTED]> wrote:
>
>
> 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
>
-------------------------------------------------------------------------
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