Guest User

Untitled

a guest
Jul 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. translate.c: In function 'main':
  2.  
  3. translate.c:65: warning: passing argument 2 of 'strncmp' makes pointer from integer without a cast
  4.  
  5. /usr/include/string.h:146: note: expected 'const char *' but argument is of type 'char'
  6.  
  7. translate.c:67: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast
  8.  
  9. /usr/include/string.h:128: note: expected 'char * __restrict__' but argument is of type 'char'
  10.  
  11. translate.c:88: warning: passing argument 1 of 'strcpy' from incompatible pointer type
  12.  
  13. /usr/include/string.h:128: note: expected 'char * __restrict__' but argument is of type 'struct node *'
  14.  
  15. translate.c:100: warning: format '%s' expects type 'char *', but argument 3 has type 'struct node *'
  16.  
  17. #include<stdio.h>
  18. #include<stdlib.h>
  19. #include<string.h>
  20.  
  21. typedef struct node{
  22. char seq[300];
  23. struct node* next;
  24. } NODE;
  25.  
  26.  
  27. int
  28. main(int argc, char* argv[]){
  29.  
  30. int i, j=0;
  31. FILE *fin, *fout, *fop;
  32. char code1[100], code2[100], prot1[2], prot2[4];
  33. NODE *current, *first, *prev;
  34.  
  35. fin = fopen( argv[1], "r");
  36. fout = fopen( argv[2], "w");
  37. fop = fopen("codeoflife.txt", "r");
  38.  
  39. code2[0] = '';
  40. current = first = malloc (sizeof (NODE));
  41.  
  42. while( fscanf( fin, "%s", current -> seq) != EOF) {
  43.  
  44. for (i = 0; i < 300; i++){
  45. if (current->seq[i] == 'a')
  46. current->seq[i] = 'A';
  47. else if (current->seq[i] == 't')
  48. current->seq[i] = 'T';
  49. else if(current->seq[i] == 'g')
  50. current->seq[i] = 'G';
  51. else if(current->seq[i] == 'c')
  52. current->seq[i] = 'C';
  53. }
  54.  
  55. if ( (current -> next = malloc ( sizeof(NODE) ) ) == NULL){
  56. fprintf(fout, "Out of memorynCan't add more DNA sequencesn");
  57. return EXIT_FAILURE;
  58. }
  59. prev = current;
  60. current = current -> next;
  61.  
  62. }
  63.  
  64. fclose(fin);
  65. current = first;
  66.  
  67.  
  68. while(current->next != NULL){
  69. for( i = 0; i < 300; i++){
  70. if( current->seq[i] == 'A')
  71. if( current->seq[i+1] == 'G')
  72. if( current->seq[i+2] =='T'){
  73. i = i+3;
  74. j = 0;
  75. code1[j] = 'M';
  76. while(fscanf(fop, "%s%s", prot1, prot2) != EOF){
  77. if(strcmp(prot2, "TAA") == 0 || strcmp(prot2, "TAG") == 0 || strcmp(prot2, "TGA") == 0){
  78. fclose(fop);
  79. break;
  80. }
  81. /* line 65 */ if(strncmp(prot2, current->seq[i], 3) == 0){
  82. j++;
  83. /* line 67*/ strcpy(code1[j], prot1);
  84. fclose(fop);
  85. i = i + 3;
  86. }
  87. }
  88.  
  89. if(strcmp(code1, code2) > 0)
  90. strcpy(code2, code1);
  91. //else if (strcmp(code1, code2) < 0)
  92.  
  93. }
  94.  
  95.  
  96. }
  97.  
  98. if(strcmp(prot2, "TAA") != 0 && strcmp(prot2, "TAG") != 0 && strcmp(prot2, "TGA") != 0){
  99. strcpy ( current->seq, "None");
  100. current = current->next;
  101. continue;
  102. }
  103.  
  104. /* line 88 */ strcpy(current->next, code2);
  105.  
  106. current = current->next;
  107.  
  108. code2[0] = '';
  109. }
  110.  
  111. free(current);
  112. prev->next = NULL;
  113. current = first;
  114.  
  115. while(current->next != NULL){
  116. /* line 100 */ fprintf( fout, "n%sn", current->next);
  117. current = current->next;
  118. }
  119.  
  120. return 0;
  121. }
  122.  
  123. 65: strncmp(prot2, &current->seq[i], 3)
  124. 67: strcpy(&code1[j], prot1)
  125. 88: strcpy((char *)current->next, code2)
  126. 100: fprintf( fout, "n%sn", (char *)current->next);
Add Comment
Please, Sign In to add comment