Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #76043

Re: how to do this?

From bilsch01 <king621@comcast.net>
Newsgroups comp.lang.c
Subject Re: how to do this?
Date 2015-11-14 15:18 -0800
Organization A noiseless patient Spider
Message-ID <n28fc0$pmq$2@dont-email.me> (permalink)
References (1 earlier) <refactor1-20151114213139@ram.dialup.fu-berlin.de> <refactor2-20151114213529@ram.dialup.fu-berlin.de> <sandwich-20151114214604@ram.dialup.fu-berlin.de> <recursion-20151114220940@ram.dialup.fu-berlin.de> <refactor-20151114230358@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 11/14/2015 02:05 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>>> #include <stdio.h>
>>>> #include <stdio.h>
>>> #include <stdio.h>
>> #include <stdio.h>
>
>    Another refactor, SCNR:
>
> #include <stdio.h>
>
> static FILE * fp[ 4 ];
> static char * fn[ 4 ]={ "ivt0.txt", "ivt1.txt", "ivt2.txt", "ivt3.txt" };
> static char ivt[ 4 ][ 2305 ];
> static char * vec[ 4 ];
> static char mk[ 3 ][ 9 ]= "**  i  **";
>
> void c( int const i, int const j )
> { if( !strcmp( vec[ i ], vec[ j ]))strcpy( vec[ i ], mk[ j ]); }
>
> void main4()
> { c( 1, 0 ); c( 2, 0 ); c( 2, 1 ); c( 3, 0 ); c( 3, 1 ); c( 3, 2 );
>    printf( "\t%i\t%s\t%s\t%s\t%s\n", i, vec[ 0 ], vec[ 1 ], vec[ 2 ], vec[ 3 ]); }
>
> void main3( int const i, int const n )
> { vec[ n ]= malloc( 9 ); if( vec[ n ])
>    { memcpy( vec[ n ], ivt[ n ]+ i * 9, 9 );
>      if( n < 3 )main3( i, n + 1 ); else main4();
>      free( vec[ n ]); }}
>
> void main2( void )
> { for( int i = 0; i < 256; ++i )main3( i, 0 );  }
>
> void main1( int const i )
> { fp[ i ]= fopen( fn[ i ], "r" );
>    if( !fp[ i ])printf( "error opening file %s\n", fn[ i ] ); else
>    { fread( ivt[ i ], 1, 2304, fp[ i ]);
>      if( i < 3 )main1( i + 1 ); else main2()
>      fclose( fp[ i ]); }}
>
> int main( void )
> { printf( "\n\n\n\tvec#\t  ivt0\t\t  ivt1\t\t  ivt2\t\t  ivt3\n\n" );
>    main1( 0 );
>    printf( "\n\t\t\t\t Shift+PgUp/PgDn to scroll\n\n" ); }
>
>    still untested and therefore intended to be read more as
>    pseudocode (sketch of an idea) than as C.
>
  Thanks for the step by step instruction.  That makes it understandable.

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 12:09 -0800
  Re: how to do this? Rosario19 <Ros@invalid.invalid> - 2015-11-14 21:49 +0100
  Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 10:02 +1300
    Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 10:17 +1300
    Re: how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 15:16 -0800
      Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 18:24 -0500
        Re: how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 15:30 -0800
          Re: how to do this? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-14 19:01 -0500
          Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 19:07 -0500
  Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 11:26 +1300
    Re: how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 15:07 -0800
      Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 18:17 -0500
      Re: how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 15:25 -0800
        Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 13:10 +1300
          Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 19:21 -0500
            Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 13:24 +1300
        Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 19:12 -0500
          Re: how to do this? Ian Collins <ian-news@hotmail.com> - 2015-11-15 13:18 +1300
            Re: how to do this? James Kuyper <jameskuyper@verizon.net> - 2015-11-14 19:23 -0500
  Re: how to do this? bilsch01 <king621@comcast.net> - 2015-11-14 15:18 -0800

csiph-web