473,763 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8904
"christos panagiotou" <cp******@cs.uc l.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.b in", 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
5183
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 for files that contain certian strings and if the files found to have these string do not already have a filename extension (such as '.doc' or '.xls') the function will append that to the files and rename them. So, if a file named 'report' was...
2
1942
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. Is it possible to read each of these dynamically in python ?? If so, how should my code look like ?? If it was not dynamically required, then, I would change the name of the file in my *open* statement every time and read the corresponding one. But...
4
1830
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 will be each file, and the second every line in that file. I tried to do something like this: files_and_lines = filenumber = 0
3
1730
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 binascii module without any luck. Best regards, -fredrik-normann-
2
2701
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() method (exact signature not remembered) of the std::istream class ? When I'm reading the value in objects attribute (member variable), the read fails, but when I'm reading in a local variable value is successfully read as shown below: ..... any...
10
2141
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 reading files. Based on the tutorials at www.python.org This "should" work. but im not sure what the issue is. ===SNIP=== import string
1
1371
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 hyperlink to them. How can i do this. as an example... let's say my page resides at /mysite/dir1/default.aspx. now in /mysite/dir1 are the files pic.jpg, pic1.jpg, pic2.jpg.
2
3849
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 files from these sub directories. I am using this code opendir(DIR, $lpath); @flist = readdir(DIR); closedir(DIR); when I do this @flist also contains files from sub directories and I do want that. How can I avoid reading files from...
5
1956
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 files in a single file so that iam trying to read the file from the directory,which iam not able to... here is the code #!/usr/bin/perl $dir = "D:\\perl program\\perl\\bin\\malar"; opendir DH,$dir; @files = readdir(DH); foreach $files(@files){...
4
1899
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 developed it was making a duplicate of each file and then deleting the prefix on the copied file so the following statement could read a generic "filename":
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.