home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / test / copy_test_outp < prev    next >
Encoding:
Text File  |  1992-08-27  |  349 b   |  31 lines

  1. #include <stdio.h>
  2.  
  3. main(argc, argv)
  4.  
  5. int argc;
  6. char **argv;
  7.  
  8. {
  9.     char s[100];
  10.  
  11.     FILE *fp, *fopen();
  12.  
  13.     PQsetdb("test");
  14.     PQexec("copy jj () from stdin");
  15.     printf("begin copy\n");
  16.  
  17.     fp = fopen(argv[1], "r");
  18.  
  19.     while (!feof(fp))
  20.     {
  21.         fgets(s, 100, fp);
  22.         if (!feof(fp))
  23.         {
  24.             PQputline(s);
  25.         }
  26.     }
  27.     PQputline(".\n");
  28.     PQendcopy();
  29.     printf("done\n");
  30. }
  31.