title: Strings read from .txt being redefined for no apparent reason in C
body: <p>I'm stuck working on a college project in c:</p>
  <pre><code>char ID[10],tipo[10],origen[50],destino[50],hora_salida[5],hora_llegada[5];
  int duracion;
  float precio;
  FILE *fp;
  chdir(&quot;BASEDATOS&quot;);
  fp=fopen(nombreArchivo,&quot;rt&quot;);
  fseek(fp,228*sizeof(char),SEEK_SET);
  setlocale(LC_CTYPE,&quot;spanish&quot;);
  gotoxy(1,1);
  fscanf(fp,&quot;%s&quot;,ID);
  fscanf(fp,&quot;%s&quot;,tipo);
  fscanf(fp,&quot;%s&quot;,origen);
  fscanf(fp,&quot;%s&quot;,destino);
  printf(&quot;%s\n&quot;,destino);
  fscanf(fp,&quot;%s&quot;,hora_salida);
  printf(&quot;%s\n&quot;,destino);
  </code></pre>
  <p>(function gotoxy() works as intended and does not interact with the variables or the txt file)<br />
  So I have an issue with this particular function within the project, I need to read some strings of a .txt file, and the problem appears when I scan the &quot;destino&quot; variable. For some reason the value changes when I scan the next string (hora_salida), although I haven't used the variable &quot;destino&quot; at all.</p>
  <p>The first lines of the txt file are in this format:</p>
  <p><a href="https://i.stack.imgur.com/cikEj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cikEj.png" alt="https://imgur.com/a/aaHwo" /></a></p>
  <p>Note that I use fseek to skip the first three lines which are of no use.</p>
  <p>The outcome of the code is the following:</p>
  <pre><code>Madrid-Chamartín\n
  (blank space)
  </code></pre>
  <p>So destino is getting the desired value at first, but gets blank afterwards.</p>