title: Unable to assign values for strings when read data from file
body: <p>I have a config.txt file where I'm storing the configurations needed to generate some records and I want to read the config values through C code and assign the parameter values to some variables. For integers and floats the variables are assigned correctly but for string types everytime the loop runs all the string variables are getting updated instead of one particular.</p>
  
  <p>Contents of config.
  <code>
  TIME_LIMIT=2
  ING_IP=45.45.45.45
  TIMEZONE=GMT+05:30-India</code></p>
  
  <pre><code>    const char* timeZone = "GMT+09:00-Tokyo";
      const char* ingIp = "null";
      int timeLimit = 0;
  
      char *configFileName = argv[++i];
  
      FILE *configFileHandle = fopen(configFileName, "r");
  
      char * line = NULL;
  
      // if (( fgets(line, 500, configFileHandle)) != NULL){
      //     puts(line);
      // }
  
      size_t len = 0;
      ssize_t read;
  
      while ((read = getline(&amp;line, &amp;len, configFileHandle)) != -1) {
  
          printf("Line: %s\n", line);
          char *parameter = strtok(line, "=");
          char *value = strtok(NULL, "=");
  
  
          char *ptr;
          if( (ptr = strchr(value, '\n')) != NULL)
              *ptr = '\0';
  
          if( (ptr = strchr(value, '\r')) != NULL)
              *ptr = '\0';
  
          if ( strcmp(parameter, "TIME_LIMIT") == 0 ) {
              timeLimit = atoi(value);
          }else if ( strcmp(parameter, "TIMEZONE") == 0 ) {
              timeZone = value;
          }else if ( strcmp(parameter, "ING_IP") == 0 ) {
              ingIp = value;
          }
      }
  </code></pre>
  
  <p>The results I'm getting is on each iteration timeZone value is getting overwritten by the latest value of ingIp. I want to assign ingIp = "45.45.45.45" and timeZone = "GMT+05:30-India". For timeLimit the value is getting assigned properly.</p>