Index: trunk/Ohana/src/opihi/cmd.data/vload.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/vload.c	(revision 2843)
+++ trunk/Ohana/src/opihi/cmd.data/vload.c	(revision 3693)
@@ -6,5 +6,5 @@
   int Ximage, Nimage;
   double dx, dy;
-  char *buffer, *line;
+  char *buffer;
   Vector *vecx, *vecy;
   
@@ -33,13 +33,10 @@
   ALLOCATE (buffer, char, 65536);  /* space for 512 lines of 128 bytes */
   bzero (buffer, 65536);
-  ALLOCATE (line, char, 1024);     /* space to read the file */
   Nline = 0;
 
-  write (Ximage, "LOAD", 4); /* force Ximage to look for the incoming image */
-  sprintf (line, "OVER %9d ", n);
-  write (Ximage, line, 16);
-  
+  SendGraphCommand (Ximage, 4, "LOAD");
+  SendGraphCommand (Ximage, 16, "OVER %9d ", n);
+
   dx = dy = 1.0;
-
   for (i = 0; i < vecx[0].Nelements; i++) {
     snprintf (&buffer[Nline*128], 128, "%15s %20.10f %20.10f %20.10f %20.10f ", "BOX", 
@@ -47,6 +44,5 @@
     Nline ++;
     if (Nline == 512) {
-      sprintf (line, "NLINES  %7d ", Nline);
-      write (Ximage, line, 16);
+      SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
       write (Ximage, buffer, Nline*128);
       bzero (buffer, 65536);
@@ -55,12 +51,9 @@
   }
 
-  sprintf (line, "NLINES  %7d ", Nline);
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
   write (Ximage, buffer, Nline*128);
-  sprintf (line, "DONE ");
-  write (Ximage, line, 16);
+  SendGraphCommand (Ximage, 16, "DONE");
 
   free (buffer);
-  free (line);
   fprintf (stderr, "loaded %d objects\n", n);
 
