|
[Sponsors] |
February 16, 2015, 16:36 |
Problem with binary file
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi all,
I want to open a binary file with FOAM Classes but I fail and I do not know why. The code is working with the following: Code:
char tag[40]; std::fstream is; is.open("Filename", std::ios::in | std::ios:binary); is.read(tag, sizeof(tag)); Info<< tag << "\n"; If I replace it with Foam classes like: Code:
char tag[40] fileName name_ = "Filename"; IFstream is(name_, IFstream::BINARY); is.read(tag, sizeof(tag)); Code:
--> FOAM FATAL IO ERROR: Expected a '(' while reading binaryBlock, found on line 1 the word 'version'
__________________
Keep foaming, Tobias Holzmann |
|
March 5, 2015, 17:36 |
|
#2 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
maybe convert binary into ASCII then do your job? haha.
|
|
March 5, 2015, 21:31 |
|
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Let me know how?!
The binary file is closed and is generated by a closed source ... Nontheless I solved the problem!
__________________
Keep foaming, Tobias Holzmann |
|
March 6, 2015, 02:23 |
|
#4 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to calculate mass flow rate on patches and summation of that during the run? | immortality | OpenFOAM Post-Processing | 104 | February 16, 2021 08:46 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 19:43 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 11:32 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 05:18 |
ParaView Compilation | jakaranda | OpenFOAM Installation | 3 | October 27, 2008 11:46 |