Builder/Builder/Common/plyfile.c
/******************************************************************************
Write out an item to a file as ascii characters.

Entry:
  fp         - file to write to
  int_val    - integer version of item
  uint_val   - unsigned integer version of item
  double_val - double-precision float version of item
  type       - data type to write out
******************************************************************************/
Write out an item to a file as ascii characters.
Write out an item to a file as ascii characters .
void write_ascii_item(
  FILE *fp,
  int int_val,
  unsigned int uint_val,
  double double_val,
  int type
)
{
  switch (type) {
    case PLY_CHAR:
    case PLY_SHORT:
    case PLY_INT:
      if (fprintf (fp, "%d ", int_val) <= 0)
      {
	  fprintf(stderr, "PLY ERROR: fprintf() failed -- aborting.\n");
	  exit(1);
      }
      break;
    case PLY_UCHAR:
    case PLY_USHORT:
    case PLY_UINT:
      if (fprintf (fp, "%u ", uint_val) <= 0)
      {
	  fprintf(stderr, "PLY ERROR: fprintf() failed -- aborting.\n");
	  exit(1);
      }
      break;
    case PLY_FLOAT:
    case PLY_DOUBLE:
      if (fprintf (fp, "%g ", double_val) <= 0)
      {
	  fprintf(stderr, "PLY ERROR: fprintf() failed -- aborting.\n");
	  exit(1);
      }
      break;
    default:
      fprintf (stderr, "write_ascii_item: bad type = %d\n", type);
      exit (-1);
  }
}
void write_ascii_item ( FILE * fp , int int_val , unsigned int uint_val , double double_val , int type ) { switch ( type ) { case PLY_CHAR : case PLY_SHORT : case PLY_INT : if ( fprintf ( fp , " " , int_val ) <= 0 ) { fprintf ( stderr , " \n " ) ; exit ( 1 ) ; } break ; case PLY_UCHAR : case PLY_USHORT : case PLY_UINT : if ( fprintf ( fp , " " , uint_val ) <= 0 ) { fprintf ( stderr , " \n " ) ; exit ( 1 ) ; } break ; case PLY_FLOAT : case PLY_DOUBLE : if ( fprintf ( fp , " " , double_val ) <= 0 ) { fprintf ( stderr , " \n " ) ; exit ( 1 ) ; } break ; default : fprintf ( stderr , " \n " , type ) ; exit ( -1 ) ; } }
Write out an item to a file as ascii characters.
Write out an item to a file as ascii characters .
//case PLY_FLOAT32: