On 03/10/2014 at 20:18, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
---------
Hi Folks,
I'm trying to learn some basics of writing and reading to a file type. Nothing spectacular, but I need a small function to write some data to file that can be opened again later. The following is what I've been testing with:
Filename FN;
FN.SetDirectory(GeGetPluginPath());
FN.SetFile("Test File Save");
FN.SetSuffix("txt");
AutoAlloc< BaseFile > bf;
//FN.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, "Save Your Work"); //Opens the file browser
if(bf->Open(FN.GetFile(),FILEOPEN_WRITE,FILEDIALOG_ANY,BYTEORDER_INTEL,MACTYPE_CINEMA,MACCREATOR_CINEMA) == TRUE)
{
MessageDialog("File opened succesfully..");
bf->WriteString("Test string");
}
if(bf->Close() == TRUE)
{
MessageDialog("File closed succesfully..");
}
Two queries follow:
First, the problem: if I uncomment the FN.Fileselect() line, I can see that there are previous saves of the file, but when I look in explorer etc, they're not visible. Doesn't matter if it's in the plugin folder, or on the desktop, they don't show. Why is this?
For the purpose of testing, I'm simply trying to save to the plugin's path, in a text file-like format. If it helps, one thing I did note is that when I use the 'save file dialog' I can see that the icons have a little lock on them (something of the sorts anyway) but when I right click to try open them from within the save file dialog, notepad says it can't find the file.
Second: is it possible to override the file icon with your own in the saved file (whether with Cinema or standard routines)?
Cheers,
WP.
P.s. I might just mention too, ignore the bf.WriteString() as I think for a text file it might need to be a series of chars (is this correct?). For the moment though, unless that itself causes a problem, I just want to be able to see the file, to save and load it within Cinema - that's all it will need.