FGLGETS.C Bugs?
Posted in 1994
Is there a problem with the fglgets.c function? I typed it in and added another function to display all open files. But my output keeps looking like: Num files = 1 File Location[ 0 ] = 2045642 Filename[ 0 ] = rob8 Here is the 4gl linked with fglgets.c: # main.4gl main define string char(80) call fglgets( "rob1" ) returning string call fglgets( "rob2" ) returning string call fglgets( "rob3" ) returning string call fglgets( "rob4" ) returning string call fglgets( "rob5" ) returning string call fglgets( "rob6" ) returning string call fglgets( "rob7" ) returning string call fglgets( "rob8" ) returning string call fgl_names() end main Here is the added fgl_names function to fglgets.c: fgl_names( numargs ) int numargs; { register int j; fprintf( stdout, "Num files = %d\\n", nfiles ); for ( j = 0; j < nfiles; j++ ) fprintf( stdout, "File Location[%d] = %o\\n", j, files[ j ] ); for ( j = 0; j < nfiles; j++ ) fprintf( stdout, "Filename[%d] = %s\\n", j, fnames[ j ] ); return( 0 ); } I do have a work around ( modified 2 lines from the fglgets.c file ) but is this expected? BTW, here is my modified work-around. /* FROM: static char *fnames[ MAXOPEN ]; TO: */ static char fnames[MAXOPEN][ MAXSTR ]; AND /* FROM: fnames[ j ] = astring; TO: */ strcpy( fnames[ j ], astring ); Then everything works OK. Robert Minter |Data Systems Support| \\\\\\_/// Programmer, Software Development | Orange, CA | ( _ _ ) internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |) bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/ #include <disclaimer.h> SURF'S UP \\_/