I have a function defined as the following (in C):
gchar **Scan_Return_File_Tag_Field_From_Mask_Code (File_Tag *FileTag, gchar code)
{
switch (code)
{
case t : /* Title */
return &FileTag->title;
case a : /* Artist */
return &FileTag->artist;
case b : /* Album */
return &FileTag->album;
case d : /* Disc Number */
return &FileTag->disc_number;
case y : /* Year */
return &FileTag->year;
case n : /* Track */
return &FileTag->track;
case l : /* Track Total */
return &FileTag->track_total;
case g : /* Genre */
return &FileTag->genre;
case c : /* Comment */
return &FileTag->comment;
case p : /* Composer */
return &FileTag->composer;
case o : /* Orig. Artist */
return &FileTag->orig_artist;
case r : /* Copyright */
return &FileTag->copyright;
case u : /* URL */
return &FileTag->url;
case e : /* Encoded by */
return &FileTag->encoded_by;
case i : /* Ignored */
return NULL;
default:
Log_Print(LOG_ERROR,"Scanner: Invalid code %%%c found!",code);
return NULL;
}
}
I am trying to add a new condition to the switch statement, such as
case f :
In which it would return the first character of &FileTag->artist.
I have scoured all of the internet looking for a solution, but have come up empty handed. Anyone have any ideas?
Update:
If it helps, this function is part of the application EasyTag. From what I have seen looking through the code, this is where the new file name for easytag s file sorting feature is determined. I am trying to add a new variable to allow the application to sort music into directories like so: <First letter of artist name>/<Artist>/<Album>/<Tracks>
There is always the chance that I may be looking at the wrong function, but to the best of my knowledge I am.
Another Update: I got this function working as I wanted (pointers are funny little things), but it does not, as pointed out below, do what I had expected it to. Thanks for all the help and patience!