title: Calling C function from Swift
body: <p>I am trying to call a C function from Swift , but I do not know exactly how to define variables to pass parameters.</p>
  
  <p>The function c is:</p>
  
  <pre><code>DBFGetFieldInfo( DBFHandle psDBF, int iField, char * pszFieldName, int * pnWidth, int * pnDecimals );
  </code></pre>
  
  <p>The main problem is <code>pszFieldName</code>, <code>pnWidth</code> and <code>pnDecimals</code> inout parameters. I tried made ​​:</p>
  
  <pre><code>var dbf:DBFHandle = DBFOpen(pszPath, "rb")
  var fName:[CChar] = [] 
  var fieldWidth:Int32 = 0
  let fieldDecimals:Int32 = 0
  
  let fieldInfo:DBFFieldType = DBFGetFieldInfo(dbf, i, fName, &amp;fieldWidth, &amp;fieldDecimals)
  </code></pre>
  
  <p>but it gives me an error</p>
  
  <pre><code>Cannot invoke 'DBFGetFieldInfo' with an argument list of type '(DBFHandle, Int32, [CChar], inout Int32, inout Int32)'
  Expected an argument list of type '(DBFHandle, Int32, UnsafeMutablePointer&lt;Int8&gt;, UnsafeMutablePointer&lt;Int32&gt;, UnsafeMutablePointer&lt;Int32&gt;)'
  </code></pre>
  
  <p>Any ideas?</p>