title: Error: Segmentation fault using fopen and open
body: <p>I'm connecting a BeagleBoneBlack with a IMU using I2C protocol. I already read data in console great but when im trying to store data in a .txt file, it return me error: Segmentation fault.</p>
  
  <pre><code>int I2C_open()
  {
      int file;
      char *dev = "/dev/i2c-1";
      if ((file=open(dev,O_RDWR))&lt;0);
      {
          perror("Abrir el canal");
      }
      return file;
  }
  
  int main()
  {
      archivo=I2C_open();
      f=fopen("./home/debian/Desktop/Comunicacion/Prueba.txt","W");
      fprintf(f,"Datos leidos del sensor");
  }
  </code></pre>
  
  <p>This is just part of the code because it's large. The problem is presented when i use the fprintf, when i commented that line the code run well. Im not sure if is because im using fopen while "/dev/i2c-1" is running. Please help</p>