Asha,
It's simple, just step through the FO_BookComponents of the book and set the FP_Name property. Once you set that to a file path, that component becomes a chapter that points to that file.
For example, assume that you use an F_StringsT list to store the list of files for the book. You could do something like the following (warning, I didn't test this at all, just typing quickly into this forum page):
F_StringsT paths;
F_ObjHandleT bookId, compId, nextCompId;
UIntT i;
/* Need code here to populate paths and open up the book */
/* Afterwards, we can turn those file paths into book chapters */
compId = F_ApiGetId(FV_SessionId, bookId, FP_FirstComponentInBook);
for(i = 0; i < paths.len; i++)
{
if(compId)
{
F_ApiSetString(bookId, compId, FP_Name, paths.val);
compId = F_ApiGetId(bookId, compId, FP_NextComponentInBook);
}
}
/* Now, if there are any extra "dummy" chapters left over in the book, delete them */
while(compId)
{
nextCompId = F_ApiGetId(bookId, compId, FP_NextComponentInBook);
F_ApiDelete(bookId, compId);
compId = nextCompId;
}
F_ApiDeallocateStrings(&paths);