Hi.
This is for creating a DVD, but it shows the basics anyway.
int main()
{
... NeroInit stuff...
NERO_WRITE_CD *write_cd = NULL;
... create your write_cd
GetIsoTrack( &write_cd->nwcdIsoTrack );
... NeroBurn stuff ...
}
int GetIsoTrack( CNeroIsoTrack** ppIsoTrack)
{
*ppIsoTrack = NULL;
NERO_ISO_ITEM* pItem = NULL;
if( CreateIsoTree( "A:\\Path\\To\\Your\\Files\\*.*", &pItem ) ) {
cerr << "Error: CreateIsoTree()." << endl;
return 1;
}
DWORD dwFlags = NCITEF_USE_JOLIET | NCITEF_CREATE_ISO_FS | NCITEF_CREATE_UDF_FS |
NCITEF_DVDVIDEO_REALLOC | NCITEF_DVDVIDEO_CMPT;
NERO_CITE_ARGS citeArgs;
memset (&citeArgs, 0, sizeof (citeArgs));
citeArgs.dwBurnOptions = dwFlags;
citeArgs.name = "";
citeArgs.firstRootItem = pItem;
citeArgs.abstract = "";
citeArgs.application = "";
citeArgs.bibliographic = "";
citeArgs.copyright = "";
citeArgs.dataPreparer = "";
citeArgs.publisher = "";
citeArgs.systemIdentifier = "";
citeArgs.volumeSet = "";
// Finally, create the ISO track.
*ppIsoTrack = NeroCreateIsoTrackEx (NULL, (const char *) &citeArgs, NCITEF_USE_STRUCT);
if( NULL == *ppIsoTrack ) {
cerr << "Error: NeroCreateIsoTrackEx()." << endl;
return 1;
}
return 0;
}
// This is from a separate CPP
#include "stdafx.h"
#include < iostream >
#include < io.h >
#include < time.h >
using namespace std;
// Current time is static so we don't have to construct it all the time
static struct tm *date = NULL;
int CreateIsoTree( const string &Dir, NERO_ISO_ITEM **Root_item )
{
intptr_t file_handle;
struct _finddata_t rec;
string path = Dir.substr( 0, Dir.rfind( "\\" ) +1 );
string s;
NERO_ISO_ITEM *new_item = NULL;
if( NULL == date ) {
time_t t;
time( &t );
date = localtime( &t );
}
file_handle = _findfirst( Dir.c_str(), &rec );
if( -1 == file_handle )
return 1; // invalid path
do {
s = rec.name;
if( ( "." == s ) || ( ".." == s ) )
continue;
s = path + s;
new_item = NeroCreateIsoItem();
if( NULL == new_item )
return 2;
new_item->entryTime = *date;
strcpy( new_item->fileName, rec.name );
strcpy( new_item->sourceFilePath, s.c_str() );
if( NULL != *Root_item )
new_item->nextItem = *Root_item; // easier and faster to add to the beginning
*Root_item = new_item;
if( rec.attrib & _A_SUBDIR ) {
// Directory
new_item->isDirectory = 1;
CreateIsoTree( s + "\\*.*", &new_item->subDirFirstItem );
}
} while( 0 == _findnext( file_handle, &rec ) );
_findclose( file_handle );
return 0;
}
Hope this helps.