title: Pointer to string of type int
body: <p>I'm trying to get a pointer to a <code>string</code>, where the pointer is of type <code>int</code>.  I'm not sure if I'm doing it correctly.  I just found out yesterday about <a href="http://msdn.microsoft.com/en-us/library/chfa2zb8%28v=vs.71%29.aspx" rel="nofollow">unsafe</a> and <a href="http://msdn.microsoft.com/en-us/library/f58wzh21%28v=vs.71%29.aspx" rel="nofollow">fixed</a>, so I'm still questioning this a bit.  Can I just cast the <code>char*</code> to <code>int</code>? I'm not getting any errors, but the methods are not working, so I'm not sure if the pointer is wrong or if I'm doing something wrong with the 3rd party OCX (for which there's no support).</p>
  
  <p>3rd Party Documentation for C++ calls:</p>
  
  <pre><code>BlobToVariant(VARIANT *pV, long BlobPointer)
  WriteVToFile(VARIANT *pV)
  </code></pre>
  
  <p>What VS2010 C# Intellisense says:</p>
  
  <pre><code>BlobToVariant(ref object v, int BlobPointer)
  WriteVToFile(ref object v)
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>string imageBlob = "superlongstring";
  
  // 3rd Party ActiveX control for tiff image files
  TIFFLib.TIFF tiff = new TIFFLib.TIFF();
  
  // Variant object that will hold image
  object blobVariant = new object();
  
  unsafe
  {
      fixed (char* p = imageBlob)
      {
          int blobPointer = (int)p;
  
          tiff.BlobToVariant(ref blobVariant, blobPointer);
          tiff.WriteVToFile(ref blobVariant);
      }
  }
  </code></pre>