• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reading float values from binary file

New Here ,
Feb 11, 2017 Feb 11, 2017

Copy link to clipboard

Copied

Hi all,
I have a binary file containing data recorded using a c program.
the data stored in files are float values.
Now I need  to retrieve the float numbers from binary file in after effects script.

This is my code:

var myFile = File.openDialog('select file');
myFile.open("r");
myFile.encoding = "binary";
for(x=0;x<myFile.length;x += 4){
     myFile.seek(x,0);
     buffer = myFile.read(4);
     ???
}

the question is how to convert the buffer to a float number?

TOPICS
Scripting

Views

584

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 10, 2017 Sep 10, 2017

Copy link to clipboard

Copied

any idea ??!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 11, 2017 Sep 11, 2017

Copy link to clipboard

Copied

LATEST

You can try use parseFload()

var myFile = File.openDialog('select file');

myFile.open("r");

myFile.encoding = "binary";

for(x=0;x<myFile.length;x += 4){

    myFile.seek(x,0);

    buffer = myFile.read(4);

    var float = parseFloat(buffer);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines