Code:
char *pa[12];
char ........;
void append(char s[],char str[], uint32_t n)
{
int i = 0;
while(str[i] != '\0')
{
s[n++] = str[i];
i++;
}
}
void substring(char *s,char *r,uint32_t st,int len)
{
int i;
//char *p;
for(i = 0; i < len; i++)
{
s = s+st;
*r++ = *s++;
//r[i] = s[i+st];
//puts(r);
//s++;
}
*r = '\0';
//puts(r);
}
//[13] read2genome: read genome into memory or pointer array[12]
void read2genome(char *pa[12],char *input)
{
FILE *fp = fopen(input,"r");
extern char ........;
while(! feof(fp))
{
char line[80];//temporarily store line content
int i = 0;
unsigned long int len;
//char tmp[80];
//fgets(tmp,fp);
fscanf(fp,"%s",line);
if(line[0] == '>')
{
i++;
len = 0;
ss = (char *) malloc(50000000);
pa[i] = ss;
puts(line);
}else{
if(line[0] == 'A' || line[0] == 'C' || line[0] == 'G' || line[0] == 'T')
{
append(ss,line,len);
len = strlen(line)+len;
}
}
}
fclose(fp);
}
Code:
int main(int argc,char *argv[])
{
read2genome(pa,argv[2]);
substring(pa[1],ss,6553500,12);
return 0;
}
result :
error
the size of source file is very big
why error while the number is very big ?