473,287 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

reading .raw files (windows-linux)

hi all

I am trying to open some .raw files that represent images (256x256, 8
bit per pixel, no header) in a c++ program
I cannot copy paste the module here as it uses a method from the VTK
(Visualization Toolkit)

the module i ve got is already tested with the same dataset and it works

if these files have been created under windows and copied in linux (i am
developing under linux) would this change something? do they need
different handling? I cannot think something else at the moment as the
module is tested under windows

i would appreciate any help
christos

Jul 19 '05 #1
2 8864
"christos panagiotou" <cp******@cs.ucl.ac.uk> wrote...
I am trying to open some .raw files that represent images (256x256, 8
bit per pixel, no header) in a c++ program
I cannot copy paste the module here as it uses a method from the VTK
(Visualization Toolkit)

the module i ve got is already tested with the same dataset and it works

if these files have been created under windows and copied in linux (i am
developing under linux) would this change something? do they need
different handling? I cannot think something else at the moment as the
module is tested under windows


Your question has one answer here, in comp.lang.c++, and it's
"Yes, it would potentially change something". What exactly
it would change you need to ask either in a Linux programming
newsgroup or in a newsgroup where 'raw' files are on topic
(comp.graphics.algorithms, maybe?)

Victor
Jul 19 '05 #2
> if these files have been created under windows and copied in linux (i am
developing under linux) would this change something? do they need
different handling? I cannot think something else at the moment as the
module is tested under windows

Probably, and assuming we are taking about binary files. In *nixes there
are a few differences on how files are handled than in Windows.

More specificaly:

"The C++ library <fstream> recognizes two kinds of files: binary and
text files. By default all files are opened as text files. To open a
binary file you should include the ios::binary value in the openmode
argument for the open function such as:

ifstream inputFile
inputFile.open("somename.bin", ios::in | ios::binary);

On some operating platforms (e.g. Unix) there is no difference between
binary files and text files and the use of the ios::binary argument has
no effect. On other platforms (e.g. MSDos, Windows) they have a distinct
difference.

Thos platforms that differentiate between text files and binary files do
so in these ways:

1. When a program writes a newline (\n) character to a binary file, the
file system writes the single newline character which on most platforms
is the same as the linefeed (0x0a) character
2. When the program writes a newline character to a text file, the files
system writes two characters: a carriage return character (0x0d)
followed by a linefeed character (0x0a)
3. When the program reads a newline character from a binary file, the
file system reads the signle newline character into memory
4. When the program reads a carriage return/linefeed character pair from
a text file, the system translates the pair into a single newline
character in memory.
5. When the program reads a single newline character -a linefeed that is
not preceded by a carriage return character- from a text file, the file
system inserts the newline character into memory.
This approach has significant implications mainly involving file
position operations -seeking and telling. "
Hope this helps
V.Z.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hokiegal99 | last post by:
This is not really a Python-centric question, however, I am using Python to solve this problem (as of now) so I thought it appropiate to pose the question here. I have some functions that search...
2
by: Satish Kumar Chimakurthi | last post by:
Hi all, An external solver program is dynamically producing files with different names 0000001.dat, 0000002.dat, 0000003.dat etc.....at regular intervals. These files contain all numeric data....
4
by: Oyvind Ostlund | last post by:
I am not sure what the right syntax is here. So please help me out (started 2 days ago). I have a list of about 20 files that I want to read line by line into a 2D list. So the first dimension...
3
by: Fredrik Normann | last post by:
Hello, I'm trying to read the binary files under /var/spool/rwho/ so I'm wondering if anyone has done that before or could give me some clues on how to read those files. I've tried to use the...
2
by: WahJava | last post by:
Hi developers, I'm running GCC (GNU C/C++ Compiler shipped with Fedora Core 2). I've written a program using IOStream classes, in which I'm reading files in ios::binary mode. I'm using read()...
10
by: Johhny | last post by:
Hello All, I am working my way through learning python as a language. I am having some issues with something that looks right and does not work. I am trying to get myself more familure with...
1
by: farseer | last post by:
Hi, I am storing certain files in the same directory as an asp page. I'd like for that page to be able to read read the names of the files in that directory with a certain extension and create a...
2
by: supra91 | last post by:
Hi, I have to read files from the parent directory and delete those files. This parent directory contains logs files. This directory also contains some sub directories and I do not want to delete...
5
by: humaid | last post by:
hi guys, iam doing a project on linguistic for which i have to extract the news from a local web site,i have done so and later i have saved all the files in a directory,now i want all the...
4
by: Miner Jeff | last post by:
Hello, I have a basic question about reading files. I have several data files where the filenames are identical except for a short (3 character) prefix. I inherited this code and the person who...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.