Well, if I can't sleep, I can at least get my code spit out.
#include [stdio.h]
#define WORKSPACE "./Workspace/"
#define LINE_LENGTH 160
int chunk_size = 43;
main()
{
int i = 0, wrote = 0;
FILE *fp;
char filename[LINE_LENGTH], insuck[LINE_LENGTH];
sprintf(filename, "%s%d", WORKSPACE, i++);
if ((fp = fopen(filename, "w")) == NULL) exit(1);
while (fgets(insuck, LINE_LENGTH, stdin) != NULL) {
fprintf(fp, "%s", insuck); wrote++;
if (wrote >= chunk_size) {
fclose(fp);
sprintf(filename, "%s%d", WORKSPACE, i++);
if ((fp = fopen(filename, "w")) == NULL) exit(1);
wrote = 0;
}
}
fclose(fp);
exit(0);
}
#include [stdio.h]
#define WORKSPACE "./Workspace/"
#define LINE_LENGTH 160
int chunk_size = 43;
main()
{
int i = 0, wrote = 0;
FILE *fp;
char filename[LINE_LENGTH], insuck[LINE_LENGTH];
sprintf(filename, "%s%d", WORKSPACE, i++);
if ((fp = fopen(filename, "w")) == NULL) exit(1);
while (fgets(insuck, LINE_LENGTH, stdin) != NULL) {
fprintf(fp, "%s", insuck); wrote++;
if (wrote >= chunk_size) {
fclose(fp);
sprintf(filename, "%s%d", WORKSPACE, i++);
if ((fp = fopen(filename, "w")) == NULL) exit(1);
wrote = 0;
}
}
fclose(fp);
exit(0);
}
no subject
Date: 2001-08-05 04:14 am (UTC)#include <stdlib.h>
Re:
Date: 2001-08-05 06:48 am (UTC)I'll count you in. :)
no subject
Date: 2001-08-05 09:23 am (UTC)Re:
Date: 2001-08-05 09:27 am (UTC)right you are, on both counts!