src/hg/oneShot/freen/freen.c 1.86
1.86 2009/02/12 00:20:38 kent
Testing simultanious writes.
Index: src/hg/oneShot/freen/freen.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/oneShot/freen/freen.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -b -B -U 1000000 -r1.85 -r1.86
--- src/hg/oneShot/freen/freen.c 10 Feb 2009 22:22:08 -0000 1.85
+++ src/hg/oneShot/freen/freen.c 12 Feb 2009 00:20:38 -0000 1.86
@@ -1,39 +1,59 @@
/* freen - My Pet Freen. */
#include "common.h"
#include "memalloc.h"
#include "dystring.h"
#include "linefile.h"
#include "hash.h"
#include "bed.h"
#include "jksql.h"
#include "binRange.h"
#include "hdb.h"
static char const rcsid[] = "$Id$";
void usage()
{
errAbort("freen - test some hairbrained thing.\n"
"usage: freen file\n");
}
-void freen(char *asciiCount)
-/* Test some hair-brained thing. */
+void writeChars(int f, char c, int count)
+/* Write a char to a low level file repeatedly followed by a new line. */
{
-int count = atoi(asciiCount);
int i;
for (i=0; i<count; ++i)
- {
- printf("%d\t0.1\n", rand()%100);
- }
+ write(f, &c, 1);
+c = '\n';
+write(f, &c, 1);
+}
+
+void freen(char *fileName)
+/* Test some hair-brained thing. */
+{
+int f = open(fileName, O_RDWR);
+if (f <= 0)
+ errAbort("Coulen't open %s", fileName);
+// lseek(f, 0, SEEK_SET);
+writeChars(f, '1', 49);
+getchar();
+// lseek(f, 50, SEEK_SET);
+writeChars(f, '2', 49);
+getchar();
+// lseek(f, 100, SEEK_SET);
+writeChars(f, '3', 49);
+getchar();
+// lseek(f, 150, SEEK_SET);
+writeChars(f, '4', 49);
+getchar();
+close(f);
}
int main(int argc, char *argv[])
/* Process command line. */
{
if (argc != 2)
usage();
freen(argv[1]);
return 0;
}