Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not quite sure why your code returns a pointer to a pointer, but that makes your desired operation slightly more difficult. Since you need to return the <em>address</em> of a pointer, and not just a pointer itself, you have to allocate that new pointer somewhere (and then who will free it?). If you don't mind the memory leak you can ignore the problem and just allocate a pointer and return its address. Or, you can create a new member of <code>File_Tag</code> that holds a short string that contains the first character of <code>artist</code>.</p> <p>The <a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html" rel="nofollow noreferrer">glib string functions</a> will be helpful for this, a quick look through the list shows <a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf" rel="nofollow noreferrer"><code>g_strdup_printf()</code></a> might be useful:</p> <pre><code>gchar *first = g_strdup_printf("%c", FileTag-&gt;artist[0]); </code></pre> <p>Then allocate somewhere to store <code>first</code> and return the address of that.</p> <p><strong>Update:</strong> Using <a href="http://codesearch.google.com" rel="nofollow noreferrer">http://codesearch.google.com</a> I seem to have <a href="http://www.google.com/codesearch/p?hl=en&amp;sa=N&amp;cd=1&amp;ct=rc#JWizIJK4oqE/easytag-1.1/src/scan.c&amp;q=Scan_Return_File_Tag_Field_From_Mask_Code&amp;l=278" rel="nofollow noreferrer">found where this function you're changing is used</a>, and it looks like the return value is used to <em>change</em> the field that is returned.</p> <pre><code> // Get the target entry for this code dest = Scan_Return_File_Tag_Field_From_Mask_Code(FileTag,mask_item-&gt;code); // We display the text affected to the code if ( dest &amp;&amp; ( OVERWRITE_TAG_FIELD || *dest==NULL || strlen(*dest)==0 ) ) ET_Set_Field_File_Tag_Item(dest,mask_item-&gt;string); </code></pre> <p>I'm not sure what exactly you want to do if your code returns a new string that contains the first character of the artist name. The above code would change what your newly allocated string <em>points to</em>, which would have no effect on the actual artist name.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload