[Scilab-users] reading binary files with some plain text

P M p.muehlmann at gmail.com
Fri Oct 1 18:14:19 CEST 2021


Hi,

there is a binary file I would like to extract some info from.

If one opens the file witha text editor (such as notepad) it turns out,
that some human readable parts are inside of the binary file.


With Scilab I can get these data parts by:

fd  = mopen(files(i),'r');            // with files(i) beeing a list
of absolute file paths
    data = mfscanf(-1, fd, '%c'); mclose(fd);
txt = strcat(data);                       // is the complete file in
one single line


Now I can do some regexp-search within the txt.

Question:

Since the file an become quite big and since the data of interest are
more to the end of the file,

the step:
data = mfscanf(-1, fd, '%c');

can take very long.

I tried

data =  mgetl (fd, -1);

which is much faster, but does not return the correct characters / string.


Any idea for exchanging the mfscanf-command?

Thank you,

Philipp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20211001/7214376d/attachment.htm>


More information about the users mailing list