dorking around
This commit is contained in:
parent
9f1aba8dd8
commit
d77bfd2366
6 changed files with 423 additions and 8 deletions
63
read.c
Normal file
63
read.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#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);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue