cs1713-test1-prog3.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2020, 2019, 2018, 2017 Girish M
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  16. * MA 02110-1301, USA.
  17. *
  18. */
  19. /*
  20. Problem statement: https://www.isical.ac.in/~pdslab/2017/exams/labtest1.pdf
  21. */
  22. #include "common.h"
  23. int main(int argc, char* argv[])
  24. {
  25. /*static int *poly1, *poly2;*/
  26. if(argc == 2)
  27. {
  28. /*FILE* fptr;
  29. size_t len, read;
  30. char* line = NULL;
  31. char* delim = " ";
  32. unsigned int no_terms[2];
  33. unsigned int i = 0;
  34. if(fptr = fopen(argv[1], "r"))
  35. {
  36. while((read = getline(&line, len, fptr)) != -1)
  37. {
  38. no_terms[i] = strtok(line, delim);
  39. poly1 = (int*) malloc(sizeof(int)*no_terms);
  40. while(no_terms1 != 0)
  41. {
  42. getline(&line, len, fptr);
  43. coeff = strtok(NULL, delim);
  44. pow = strtok(NULL, delim);
  45. }
  46. i++;
  47. }
  48. }
  49. else
  50. printf("\nError opening file\n");*/
  51. }
  52. else
  53. printf("\nUsage ./cs1713-test1-prog3.o file.txt\n");
  54. return 0;
  55. }