Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Creating a text file

    SDK Help
    0
    6
    652
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 27/05/2003 at 11:12, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   6.3 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I know this is a simple question. I am porting a plugin I worte to C++. It requires the writing of a text file. Whenever I try to create the file in C++ and write data to it, it is a binary file, not a text file.
       
      How can I write a text file from a Menu plugin?
      Thanks,
      Matt

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 27/05/2003 at 23:54, xxxxxxxx wrote:

        Use WriteBytes() instead of the formatted convenience functions. You can get a text buffer from String::GetCString().

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 28/05/2003 at 09:04, xxxxxxxx wrote:

          Now you had to know this was coming.... 🙂
          Im not very familiar with C++. I wrote a plugin in COFFEE and am trying to 'port' it to C++.  Can you give me a small example that will write a given string to a text file. Here is a sample of what I did in COFFEE:

              
              
              
              
              //RIB Header  
               file->WriteString("#RIB Export from Cinema 4D\n");  
                 
               //Frame Begin  
               file->WriteString("FrameBegin 1\n");  
                 
               //Image Options  
               file->WriteString("#Image options\n");  
               file->WriteString("Display \"test.tif\" \"file\" \"rgb\"\n");  
               file->WriteString("Display \"+test.tif\" \"framebuffer\" \"rgb\"\n");  
               file->WriteString("Format 640 480 1\n");  
               file->WriteString("Exposure 1.0 1.0\n");  
               file->WriteString("Quantize \"rgb\" 255 0 255 0.5\n");  
               file->WriteString("PixelSamples 2 2\n");  
               file->WriteString("PixelFilter \"gaussian\" 2 2\n");  
                 
               //Camera Options  
               file->WriteString("#Camera options\n");  
               file->WriteString("Projection \"perspective\" \"fov\" [53.13]\n");
              
              
              
          

          Most of the time I am reading data from the objects in the scene to write to a RIB file, but these are just static values.
          Matt

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 28/05/2003 at 09:58, xxxxxxxx wrote:

            I looked up the definition of WriteString in the API files. It looks like it is doing the same thing you told me to do manually. (It uses WriteBytes and GetCString, etc) The only thing is that it adds the length before the string. I created another funciton, WriteText, that just uses WriteBytes. However, it is still producing binary files, not text files.
             
            Any other ideas?

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 01/06/2003 at 10:41, xxxxxxxx wrote:

              What do you mean by a binary file and a text file in this context?

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 02/06/2003 at 14:48, xxxxxxxx wrote:

                Well, I am trying to write out Renderman RIB files. They need to be standard text files that you could read in notepad for example. When I tried writing out the file, notepad or the Renderman renderer would let mek now that the file was not a text file, but a binary file.
                 
                I did manage to get it working, but I used some standard C++ functions (fstream.h) to writet he files, but I fear it won't be very portable to the mac 😞
                 
                Matt

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post