Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-2008, 03:04 AM
PAUL1966 PAUL1966 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
PAUL1966 is on a distinguished road
Default are bitmap files platform dependant?

Hi!

Here is a question i started to think about when i recently started my latest project. I have not got any answer to my question yet,
so i hope that someone here might help me.

Declarations such as WORD, DWORD, UINT and LONG are as far as i know platform dependant. That is, the number of memory bytes they allocate can differ from computer to computer platform.

Now, according to the specification of a bitmap file the BITMAPFILEHEADER consist of :
UINT bfTYPE;
DWORD bfSize
and some other variables.

As the bitmap file consist of variables that are platform dependant this should then mean that the size of the bitmap file can vary between different platforms.

But as far as i know bitmap files are platform independant!!!

How is this?

//Paul
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-24-2008, 06:53 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,626
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Datatypes does not depend on the platform/operating system, but on the architecture of the processor. The names for the datatypes you see in the BITMAPFILEHEADER is just some names Windows have given them. Actually "UINT" is the same as "unsigned int," and "DWORD" is the same as "signed int," or just "int."
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-24-2008, 07:25 AM
PAUL1966 PAUL1966 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
PAUL1966 is on a distinguished road
Default

Hi!

As you say, "UINT" is the same as "unsigned int" and according to the C standard a "int" or "unsigned int" is defined as "at least 16 bits". This means that an int can actually be more than 16 bits on some architectures.

So if you have two computers with different architecture (one that defines a UINT as 16 bits, and the other that defines a UINT as 32 bits) and creates a bitmap file on one computer. Then it will be corrupt if you try to read it on the other computer, would it not?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-24-2008, 07:49 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,626
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Quote:
Originally Posted by PAUL1966
This means that an int can actually be more than 16 bits on some architectures.
On modern computers it almost always is. On 32-bit processors the size is 32-bit, and on 64-bit processors the size is 64-bit. It's possible to use real mode on most processors though, so you make the size go 16-bit instead.

About your next question; I'm not sure. I would (after I thought about it) say it would be corrupted, but I can't say for sure, I've never tried to open a 32-bit bitmap file on a 16-bit processor. There's probably some other people around here who can help you further, with a more detailed explanation.
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-24-2008, 08:29 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

What type of specifications are you looking at that lists the header with those terms? I'd have to believe it is a Windows specification list?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 01-24-2008, 08:45 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,626
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

I think he has used a specification page like those you can find on MSDN, such as this one.
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-24-2008, 08:51 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

Ahh, makes sense then. I did a quick google search and found several but all used Windows terms.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-24-2008, 09:37 AM
PAUL1966 PAUL1966 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
PAUL1966 is on a distinguished road
Default

Yes, the info is taken from a Microsoft Windows spec of Bitmap file format. But is is also the only spec i found when googlling on bitmap.

The question is the same between 32- and 64-bit computers
as between 16- and 32-bit machines.

Does anyone know?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-24-2008, 12:03 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,255
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

Another question: would the endian-ness of the OS affect reading the file?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-24-2008, 03:42 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

I've never heard that term before.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ionFiles Popular Files Module Jordan ionFiles 1 07-03-2008 03:13 PM
Alter many files, all with same variable in them woocha PHP Forum 3 01-17-2008 07:06 PM
How do I read .mbm (Multi BitMap) files? moondog General Programming 7 08-07-2007 08:08 AM
Java Help Files xXHalfSliceXx Java Help 3 11-29-2006 12:30 AM


All times are GMT -5. The time now is 07:16 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads