title: Swift convert string to UnsafeMutablePointer<Int8>
body: <p>I have a C function mapped to Swift defined as:</p>
  
  <pre><code>func swe_set_eph_path(path: UnsafeMutablePointer&lt;Int8&gt;) -&gt; Void
  </code></pre>
  
  <p>I am trying to pass a path to the function and have tried:</p>
  
  <pre><code>        var path = [Int8](count: 1024, repeatedValue: 0);
          for i in 0...NSBundle.mainBundle().bundlePath.lengthOfBytesUsingEncoding(NSUTF16StringEncoding)-1
          {
              var range = i..&lt;i+1
              path[i] = String.toInt(NSBundle.mainBundle().bundlePath[range])
          }
          println("\(path)")
          swe_set_ephe_path(&amp;path)
  </code></pre>
  
  <p>but on the path[i] line I get the error:</p>
  
  <blockquote>
    <p>'subscript' is unavailable: cannot subscript String with a range of
    Int</p>
  </blockquote>
  
  <pre><code>swe_set_ephe_path(NSBundle.mainBundle().bundlePath)
  </code></pre>
  
  <p>nor</p>
  
  <pre><code>swe_set_ephe_path(&amp;NSBundle.mainBundle().bundlePath)
  </code></pre>
  
  <p>don't work either</p>
  
  <p>Besides not working, I feel there has got to be a better, less convoluted way of doing this. Previous answers on StackOverflow using CString don't seem to work anymore. Any suggestions?</p>