Пример #1
0
int main( int argc, char *argv[] )
{
  char action;
  int sd;
  int ch;
  int i,j;

  if ( argc < 3 ) {
    printf("Usage: %s -p port\n", argv[0] );
    exit(1);
  }

    // open socket to Game Engine
  sd = tcpopen("localhost", atoi( argv[2] ));

  pipe_fd    = sd;
  in_stream  = fdopen(sd,"r");
  out_stream = fdopen(sd,"w");

  while(1) {
      // scan 5-by-5 wintow around current location
    for( i=0; i < 5; i++ ) {
      for( j=0; j < 5; j++ ) {
        if( !(( i == 2 )&&( j == 2 ))) {
          ch = getc( in_stream );
          if( ch == -1 ) {
            exit(1);
          }
          view[i][j] = ch;
        }
      }
    }

    print_view(); // COMMENT THIS OUT BEFORE SUBMISSION
    action = get_action( view );
    putc( action, out_stream );
    fflush( out_stream );
  }

  return 0;
}
Пример #2
0
void					show_alloc_mem(void)
{
	static t_zone		*ptr_view = NULL;
	t_zone				*current;

	if (!ptr_view)
		ptr_view = get_malloc();
	current = ptr_view;
	while (42)
	{
		if (current->index)
			print_view(current);
		if (current->next)
			current = current->next;
		else
			break ;
	}
	ft_putstr("Total : ");
	ft_putnbr(ptr_view->total);
	ft_putendl(" octets");
}
Пример #3
0
 inline std::basic_ostream<Char,Traits>&
 operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x) {
   return print_view(os,x);
 }
Пример #4
0
 inline std::basic_ostream<Char,Traits>&
 operator <<(std::basic_ostream<Char,Traits>& os,
             const CachedView<View>& x) {
   return print_view(os,x);
 }