Copy link to clipboard
Copied
I have a c api I created to create a book with a template it copies FM files from a templete folder and renames the book and documents form a text file with the name it will be using. The problem is the api will not open the text file, I keep getting an error saying it cannot open the file. This is working in FDK 8. I have look at the FDK 9 documents to see if anything has changed with the F_ChannelOpen and it looks the same. The source code compiles fine with no errors using the FDK 9 libs and includes. I am using MS Visual c++ 6.0 to compile the code.
What am I missing?
AllocStrings();
F_ApiBailOut();
F_FdeInit();
ChannelT chan2;
FilePathT *path2 = F_PathNameToFilePath((StringT)"C:\\Tools\\config\\CAconfig.xml", NULL, FDefaultPath);
if ((chan2 = F_ChannelOpen(path2,"r")) == NULL)
{
F_ChannelClose(chan2);
F_FilePathFree(path2);
return 0; // file does not exist
}
F_ChannelClose(chan2);
F_FilePathFree(path2);
return 1; // file does exist
}
Copy link to clipboard
Copied
This may be far too late to help you, but perhaps someone else will find value. I ran into problems with F_ChannelOpen() with FDK9 and opening a text file as well, but found a solution that works for me. (I also posted the following on the Yahoo FrameDev group yesterday.)
OK, to answer my own question...
Turns out I had to set up a few things for Unicode support. (This is an
asynchronous client, by the way). I was already setting the working directory
to $FMHOME for FM9 in order to avoid having to drag the ICU DLLs around with my
executable.
#include "fencode.h" // for FDK8/9 unicode support
:
//for FDK8/9, set ICU unicode data dir to $FMHOME\fminit\icu_data...
// StringT icu_dir previously defined elsewhere
F_SetICUDataDir(icu_dir);
F_ApiEnableUnicode(False);
errstat=F_FdeInit();
: