scc_lib_test_files.c 1010 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. //#define _GNU_SOURCE
  5. int main(int argc, char *argv[]){
  6. FILE *app_input, *log_file;
  7. char app_input_file_name[64], log_file_name[64];
  8. int time_next;
  9. strcpy(app_input_file_name,"/shared/herc/app_input.txt");
  10. //strcat(app_input_file_name, argv[1]);
  11. //strcat(app_input_file_name, "/app_input.txt");
  12. //printf("file path = %s\n",app_input_file_name);
  13. if ((app_input = fopen(app_input_file_name, "r")) == NULL){
  14. printf("Cannot open input file with file path = %s ",app_input_file_name);
  15. perror("open app_input");
  16. }
  17. fscanf(app_input,"%d",&time_next);
  18. printf("time next = %d\n",time_next);
  19. //strcpy(log_file_name,"./scenaria/");
  20. //strcat(log_file_name, scen_num);
  21. strcpy(log_file_name,"/shared/herc/log_file_test2.txt");
  22. if ((log_file = fopen(log_file_name, "w")) == NULL){
  23. //printf("open log my id is %d ",node_id);
  24. perror("open log");
  25. }
  26. fprintf(log_file,"poutanes\n");
  27. fclose(app_input);
  28. fclose(log_file);
  29. return 0;
  30. }