Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Open file on Win doesn't work

    SDK Help
    0
    4
    308
    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/2008 at 17:23, xxxxxxxx wrote:

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

      ---------
      Hi 🙂

      I have a question. I create a textfile with a texteditor and import it via the BaseFile function. The same on Win doesn't work and I get crypted chars.

      > `

        
      \>  //Reads a file and returns a string  
      \>  //*---------------------------------------------------------------------------*  
      \>  String GetFileContent(Filename fn)  
      \>  //*---------------------------------------------------------------------------*  
      \>  {  
      \>       String line = String("");  
      \>    
      \>       AutoAlloc<BaseFile> bFile;  
      \>       bFile->Open(fn, GE_READ, FILE_IGNOREOPEN, GE_MOTOROLA, MACTYPE_CINEMA, MACCREATOR_CINEMA);  
      \>                             
      \>       String token, singleChar;  
      \>       LONG fileLength = bFile->GetLength();  
      \>         
      \>       CHAR c;  
      \>       CHAR* pc = &c;  
      \>    
      \>       for (LONG i = 0; i != fileLength; i++)  
      \>       {  
      \>            bFile->ReadChar(pc);  
      \>            singleChar = pc;  
      \>    
      \>            if (pc == "\n"){  
      \>                 line += "\n";            
      \>            }  
      \>            else {  
      \>                 line += pc;                      
      \>            }  
      \>       }  
      \>       bFile->Close();  
      \>         
      \>       return line;  
      \>  }`
        
        
        
      Could someone give me a tip how to do it on win too?  
        
        
      Thanks and bye :)
      
      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/2008 at 21:05, xxxxxxxx wrote:

        Unfortunately, "\n" on PC is TWO bytes (CHARs) - 0x0D+0x0A. You'll have to check for both of these as line endings:

        // - PC uses CR+LF (0x000D+0x000A), Mac uses CR (0x000D)
        if ((c == 0x0D) || (c == 0x0A)) ...

        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/2008 at 09:22, xxxxxxxx wrote:

          Hi!

          Thank you... I don't know why, it doesn't work. I only get crypted chars. For example "Hello" in a normal textfile is converted to

          åƒ'ªƒƒ∂ª'å∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂∂

          Do you know, what I do wrong?

          Thanks

          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/2008 at 12:04, xxxxxxxx wrote:

            works!! 🙂 thanks to kuroyume0161

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