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

    Read Data from txt-file

    SDK Help
    0
    5
    392
    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 11/02/2008 at 03:45, xxxxxxxx wrote:

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

      ---------
      Hi
      i started writing a little plugin to Read Values out of a textfile to an RealArray. It's a command plugin that looks like this:
      > Filename fn;
      > BaseFile *bf = BaseFile::Alloc();
      >
      > if(!fn.FileSelect(FSTYPE_ANYTHING,0,NULL))
      > {
      >
      >> MessageDialog("Data Import Cancelled");
      > return FALSE;
      >
      > }
      >
      > if(bf->Open(fn, GE_READ))
      >
      >> MessageDialog("Data Import OK");
      Now i want to read the values stored in the selected file to an Realarray or an Vectorarray for example. Does anybody know how to do this?
      I tried:
      > bf->ReadReal(*v);
      but i don't know which variable i have to set for *v...
      Hope someone knows....

      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 11/02/2008 at 06:11, xxxxxxxx wrote:

        Is your file a text file or a binary file, becaue if it is a text file ReadReal wont help you. In this case you have to use ReadChar/ReadUChar. As parameter you pass the pointer to a char (or the indexed cell of an array).

        cheers,
        Matthias

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

          Hi Matthias,
          my file is a text file, tabulator seperated, so it seems that i have to use the ReadChar function. Sorry that i have to ask again, but i really don't know how to use this pointer *v. Can you post a little example code?
          Thx

          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 11/02/2008 at 14:06, xxxxxxxx wrote:

            CHAR c;
            bf->ReadChar(&c;);

            Your best bet here is to build a class or method that reads the text file and tokenizes by separator. In my case, I use two separate classes, FileReader and StringTokenizer. FileReader reads a line of text (using End-of-line or End-of-File) into a buffer (CHAR array). StringTokenizer than divies up the line into tokens using separator characters (spaces or tabs in most of my cases).

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

              Thx for that Robert. Wrote a FileReader and some kind of String Tokenizer and it works 🙂

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