www.pudn.com > eMule0.47c-Sources.zip > get_pic.cpp


// $Id: get_pic.cpp,v 1.8 2002/06/29 17:25:05 t1mpy Exp $ 
 
#ifdef HAVE_CONFIG_H 
#  include  
#endif 
 
#include "id3/id3lib_streams.h" 
#include  
 
#include  
#include  
 
using std::cout; 
using std::endl; 
 
int main( int argc, char *argv[]) 
{ 
  if (argc != 3) 
  { 
    cout << "Usage: get_pic  " << endl; 
    return 1; 
  } 
   
  ID3_Tag tag(argv[1]); 
  const ID3_Frame* frame = tag.Find(ID3FID_PICTURE); 
  if (frame && frame->Contains(ID3FN_DATA)) 
  { 
    cout << "*** extracting picture to file \"" << argv[2] << "\"..."; 
    frame->Field(ID3FN_DATA).ToFile(argv[2]); 
    cout << " done!" << endl; 
  } 
  else 
  { 
    cout << "*** no picture frame found in \"" << argv[1] << "\"" << endl; 
    return 1; 
  } 
 
  return 0; 
}