Converting from Swift string to const char*
<p>I'm trying to pass a const char * to an old C library converted from a Swift string in Swift.</p>

<p>This is the C function I'm calling:</p>

<pre><code>artnet_node artnet_new(const char *ip, int verbose) { ...
</code></pre>

<p>how can I convert a Swift string to this const char type? It works when I pass ipAddress like this:</p>

<pre><code>internal var ipAddress = "192.168.1.43"
</code></pre>

<p>but dit does not work when I pass it like this</p>

<pre><code>internal var ipAddress:String = "192.168.1.43"
</code></pre>

<p>I need this in a function where I need to specify the type:</p>

<pre><code>internal func setupArtnode(ip:String) -&gt; Int{
</code></pre>

<p>I tried using AnyObject instead of String but that doesn't work either.</p>

<p>Thanks.</p>