Writing files to disk



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/02/2004 at 16:01, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;   XPRESSO  ;

    ---------
    Hello! Could someone tell me why this fails? I named this code snippet, "test.cof" and put it in a folder called "test" in the c4d plugin folder.

      
    main()  
    {  
         var path = GeGetStartupPath();  
         path->RemoveLast();       
         path->AddLast("test.txt");  
           
      
         if (GeFileExist(path,FALSE))  
              {  
                   var filename = GeGetRootFilename();  
                   filename->RemoveLast();  
                   filename->Add("text.txt");  
                     
                   var testFile = new(BaseFile);  
                   testFile->Open(filename, GE_WRITE);  
                   testFile->WriteString("Hello World!");       
              }       
           
    }  
    

    The file does not get written, and the console displays no errors

    Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/02/2004 at 18:34, xxxxxxxx wrote:

    Does the file "test.txt" exist?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 00:07, xxxxxxxx wrote:

    No, I thought one could write directly to disk. Thats why I first tested if the file existed with

    if (GeFileExist(path,FALSE))
    

    Is this not possible?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 02:25, xxxxxxxx wrote:

    This must definately be some kind of bug, I keep getting "unable to write file....(file may be write protected)" errors. The file does not exist on disk!!? A paradox. If I create the file manually, the code behaves as it supposed to do.

    Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 04:41, xxxxxxxx wrote:

    nevermind, the Maxon docs were wrong again, I tried "AddLast" by coincidence and that worked. Why o why wont maxon update the docs and COFFEE? This is sometimes very annoying.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 14:58, xxxxxxxx wrote:

    Actually I couldn't find Filename::Add() in the C.O.F.F.E.E. docs. It's strange that this didn't cause a runtime error, though. I guess there must be a Filename::Add() somewhere... (Probably it's the same as the C++ "operator+(const Filename&, const Filename&)".)
    When debugging Filename related issues I often find it useful to look at the GetFullString() output.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 15:22, xxxxxxxx wrote:

    yes, there is a Filename::Add(). It´s not documented in the Filename class but is displayed in the Example code in the docs. I guess that´s why he used it in the first place.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2004 at 15:23, xxxxxxxx wrote:

    Hi Mikael, the use off add is in at least two examples in the downloadable windows CHM files. I would take your advice and use the GetFullString for debugging, I used a TextDialog instead, this lead to my discovery that the "add" was not nor working.

    n


Log in to reply