63 lines
1.1 KiB
C
63 lines
1.1 KiB
C
#define _GNU_SOURCE
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
FILE * fp;
|
|
char * line = NULL;
|
|
size_t len = 0;
|
|
ssize_t read;
|
|
|
|
size_t num_lines;
|
|
size_t max_len;
|
|
|
|
fp = fopen("./genome_VINCENT_BATTS_v5_Full_20240403215609.txt", "r");
|
|
if (fp == NULL) {
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
while ((read = getline(&line, &len, fp)) != -1) {
|
|
printf("Read line length: %zu:\n", read);
|
|
if (read > 0) {
|
|
if (line[0] == '#') {
|
|
printf("skipping a comment line ...\n");
|
|
continue;
|
|
}
|
|
if (read > max_len) {
|
|
max_len = read;
|
|
}
|
|
num_lines++;
|
|
}
|
|
//printf("%s", line);
|
|
}
|
|
|
|
printf("num_lines: %zu\n", num_lines);
|
|
printf("max_len: %zu\n", max_len);
|
|
|
|
char **arr[num_lines];
|
|
num_lines = 0;
|
|
while ((read = getline(&line, &len, fp)) != -1) {
|
|
printf("Read line length: %zu:\n", read);
|
|
if (read > 0) {
|
|
if (line[0] == '#') {
|
|
continue;
|
|
}
|
|
arr[num_lines] = &line;
|
|
num_lines++;
|
|
}
|
|
}
|
|
|
|
int num;
|
|
printf("enter a number: ");
|
|
scanf("%d", &num);
|
|
|
|
fclose(fp);
|
|
if (line) {
|
|
free(line);
|
|
}
|
|
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|