コード例 #1
0
ファイル: T_bridge.c プロジェクト: cmccausl/mc
/*
 * Bridge:  emit
 */
void
T_emit( c_t * p_file )
{
	//printf("Emitting to file: %s\n", p_file);
  static int first = 0;
  if ( first == 0 ) {
    first = 1;
    if ( 0 == ( outputfile = fopen( p_file, "w" ) ) ) {
      T_print( "bad news could not open output file" );
      T_exit( 1 );
    }
  }
  fprintf( outputfile, "%s", buffer );
//  printf("---\n");
//  printf("%s", buffer);
//  printf("---\n");
  T_clear();
}
コード例 #2
0
ファイル: T_bridge.c プロジェクト: jason-rhodes/mc
/*
 * Bridge:  emit
 */
void
T_emit( c_t * p_file )
{
  FILE * outputfile;
  if ( strcmp( "stdout", p_file ) == 0 ) {
    outputfile = stdout;
  } else {
    // Create directories as needed.
    _mkdir( p_file );
    // Open file.
    if ( 0 == ( outputfile = fopen( p_file, "w" ) ) ) {
      T_print( "bad news could not open output file" );
      T_exit( 1 );
    }
  }
  fprintf( outputfile, "%s", buffer );
  T_clear();
}