IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5173


Ignore:
Timestamp:
Sep 28, 2005, 12:12:10 PM (21 years ago)
Author:
desonia
Message:

changed p_psImagePrint to write directly to a file descriptor instead of
using fdopen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r5114 r5173  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-09-24 00:17:44 $
     11 *  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-09-28 22:12:10 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1919#include <string.h>
    2020#include <math.h>
     21#include <unistd.h>
    2122
    2223#include "psMemory.h"
     
    618619bool p_psImagePrint (int fd, psImage *a, char *name)
    619620{
    620     FILE *f;
    621     f = fdopen(fd, "a+");
    622     fprintf (f, "matrix: %s\n", name);
    623 
     621    write(fd,"matrix: ",8);
     622    write(fd,name,strlen(name));
     623    write(fd,"\n",1);
     624
     625    char buffer[20];
    624626    for (int j = 0; j < a[0].numRows; j++) {
    625627        for (int i = 0; i < a[0].numCols; i++) {
    626             fprintf (f, "%f  ", p_psImageGetElementF64(a, i, j));
     628            snprintf (buffer,20, "%f  ", p_psImageGetElementF64(a, i, j));
     629            write(fd,buffer,strlen(buffer));
    627630        }
    628         fprintf (f, "\n");
    629     }
    630     fprintf (f, "\n");
    631     fclose(f);
     631        write(fd,"\n",1);
     632    }
     633    write(fd,"\n",1);
    632634    return (true);
    633635}
Note: See TracChangeset for help on using the changeset viewer.