Open file on Win doesn't work

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 :)

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)) ...

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

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