TagLib::FileRef() could not open file!

Phong Cao phngcv at gmail.com
Sat Jul 9 01:46:05 CEST 2011

Hello everybody,

I am trying to write a program that read tag from a media file and store it
in a database. This is what I tried: I got the file's URI and then passed
the URI as argument to TagLib::FileRef():

TagLib::FileRef file(uri.c_str());

However, I could not get TagLib to open my file. Here is the error:

phongcao at phongcao-laptop ~ $ /home/phongcao/main
TagLib: Could not open file

I have read the TagLib example and the TagLib::FileRef() usage in the
example is something like this:

int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    TagLib::FileRef f(argv[i]);

  /* extract tags here */

return 0;

So my question here is what I need to pass to TagLib::FileRef()? An URI or
FileName? According to the example code in the TagLib homepage it seems that
I just need to pass the file's URI. However, the online documentation does
not say so. I am kind of confused here.

If you guys can figure out the error please let me know! Thank you and have
a good weekend!

Best regards,

Phong V. Cao
phngcv at gmail.com
caoph at rider.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110708/1c5ac6e2/attachment.htm 

More information about the taglib-devel mailing list