473,782 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading .bmp file in C

Hi all,
I want to read the pixel values of a .bmp image(which will be input to
the code) into a matrix...plz help me out as i can not understand how
to achieve this...

thanks in advance

biplab
Sep 10 '08
41 5426
Bill Cunningham wrote:
Ok I guess now after looking at wikipedia that XOR is ^ and | is OR. I
have not really encountered a use yet for these operators.
I routinely avoid reading discussions that you start; I'm not certain
that you're the troll that some people think you are, but I find it
psychically painful to see lots of good advice aimed at your head which
just bounces off without ever penetrating. Over more than a decade a lot
of good-hearted and very competent people have put a lot of effort into
trying to teach you C. Those same people could have spent the same
amount of effort to turn dozens of ordinary students into expert C
programmers; but it seems to have been utterly wasted on you.

However, I don't have any way to tell my web browser to filter out
entire threads on the basis of the fact that you started the thread; so
occasionally I do end up reading someone else's responses to you.

You've been repeatedly told not to guess at the answers, but to figure
them out. You apologize each time, but continue doing it. You've been
repeatedly told that your copy of K&R is a much better place to look for
answers than virtually any other source you are in the habit of using,
but it seems as though you almost never use K&R. You apologize each
time, and keep doing it.

There's unfortunately nothing unusual about people failing to take good
advice; but I'm curious if, instead of an apology, you could give us any
actual reason you had for ignoring the advice, even if it is a bad reason.
Sep 12 '08 #31
James Kuyper <ja*********@ve rizon.netwrites :
Bill Cunningham wrote:
> Ok I guess now after looking at wikipedia that XOR is ^ and | is
OR. I have not really encountered a use yet for these operators.

I routinely avoid reading discussions that you start; I'm not certain
that you're the troll that some people think you are, but I find it
psychically painful to see lots of good advice aimed at your head
which just bounces off without ever penetrating. Over more than a
decade a lot of good-hearted and very competent people have put a lot
of effort into trying to teach you C. Those same people could have
spent the same amount of effort to turn dozens of ordinary students
into expert C programmers; but it seems to have been utterly wasted on
you.

However, I don't have any way to tell my web browser to filter out
entire threads on the basis of the fact that you started the thread;
so occasionally I do end up reading someone else's responses to you.

You've been repeatedly told not to guess at the answers, but to figure
them out. You apologize each time, but continue doing it. You've been
repeatedly told that your copy of K&R is a much better place to look
for answers than virtually any other source you are in the habit of
using, but it seems as though you almost never use K&R. You apologize
each time, and keep doing it.

There's unfortunately nothing unusual about people failing to take
good advice; but I'm curious if, instead of an apology, you could give
us any actual reason you had for ignoring the advice, even if it is a
bad reason.
I suspect he's the alter-ego of one of the ruder "regs". They feel they
have amended for their hateful, egotistical ways by responding politely
and calmly to someone who is obviously either simple or a troll. I think
troll but he does it so well... As Robert Downey Jr says (in the role of
a black soldier following a skin pigment augmentation) - "You made the
mistake of going 'full retard'".
Sep 12 '08 #32

"Bill Cunningham" <no****@nspam.c omwrote in message
It's a bitwise or, as opposed to ||. Not very funny. I've never used
the bitwise operators so I'm going to read up on them.
At first sight the bitwise operators may appear entirely useless. Who wants
to set a bit to one if an only if two bits in the inputs are set?

However you'll soon realise that they are in fact very useful.

For instance

if( x & 1) /* if x is an odd number */

x & = 0xFF00; /* clear the lower 8 bits of x, also any bits above 16 */

lightswitch ^= 1; /* a toggle. The lightswitch goes on if it is off and vice
versa */

x <<= 1; /* these two lines will collect a series of bits in
integer */
x |= newbit; /* x, for instance for a compression algorithm */
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Sep 12 '08 #33

"Malcolm McLean" <re*******@btin ternet.comwrote in message
news:bJ******** *************** *******@bt.com. ..
At first sight the bitwise operators may appear entirely useless. Who
wants to set a bit to one if an only if two bits in the inputs are set?

However you'll soon realise that they are in fact very useful.

For instance

if( x & 1) /* if x is an odd number */

x & = 0xFF00; /* clear the lower 8 bits of x, also any bits above 16 */

lightswitch ^= 1; /* a toggle. The lightswitch goes on if it is off and
vice versa */

x <<= 1; /* these two lines will collect a series of bits in
integer */
x |= newbit; /* x, for instance for a compression algorithm */
Is the x you are working with a char ?

Bill
Sep 12 '08 #34

"Bill Cunningham" <no****@nspam.i nvwrote in message
Malcolm
>For instance

if( x & 1) /* if x is an odd number */

x & = 0xFF00; /* clear the lower 8 bits of x, also any bits above 16 */

lightswitch ^= 1; /* a toggle. The lightswitch goes on if it is off and
vice versa */

x <<= 1; /* these two lines will collect a series of bits in
integer */
x |= newbit; /* x, for instance for a compression algorithm */

Is the x you are working with a char ?
Could be an unsigned char. Or could be an int. Except for the second
example, where we have at least 16 bits, and chars are almost always 8 bits.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Sep 12 '08 #35
"Bill Cunningham" <no****@nspam.i nvwrites:
"Malcolm McLean" <re*******@btin ternet.comwrote in message
news:bJ******** *************** *******@bt.com. ..
>At first sight the bitwise operators may appear entirely useless. Who
wants to set a bit to one if an only if two bits in the inputs are set?

However you'll soon realise that they are in fact very useful.

For instance

if( x & 1) /* if x is an odd number */

x & = 0xFF00; /* clear the lower 8 bits of x, also any bits above 16 */

lightswitch ^= 1; /* a toggle. The lightswitch goes on if it is off and
vice versa */

x <<= 1; /* these two lines will collect a series of bits in
integer */
x |= newbit; /* x, for instance for a compression algorithm */

Is the x you are working with a char ?
Will either a yes or no answer to that question be of any use to you?

The bitwise operators work on integer (and yes, char is an integer
type). Most of the time they *should* be used on unsigned integers
(char may be either signed or unsigned).

I don't think you have enough understanding of the bitwise operators
for your question to be meaningful. K&R2 discusses these operators.
Come back when you've read it.

BTW, I see you're now using <no****@nspam.i nvas your return address.
My advice was to use ".invalid", not ".inv". The relevant RFC
guarantees that there will never be a ".invalid" top-level domain; it
makes no such guarantee about ".inv". This is yet another case where
you change something without understanding what you're doing.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 12 '08 #36

"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
"Bill Cunningham" <no****@nspam.i nvalidwrites:
> Ok I guess now after looking at wikipedia that XOR is ^ and | is OR.
I
have not really encountered a use yet for these operators.

You've said you have a copy of K&R2. Why the ^|&~ would you consult
Wikipedia?
I happened to be online, looked up wikipedia quickly and found my
answer. Otherwise I would have to leave the computer immediately dig through
some books and thought I'd leave that for later.

Kand R2 is very much a mouthful, or should I say head ful. I have
learned more at times from other texts and the help I get here and other
places. Nevertheless I do consult it from time to time.

Bill
Sep 12 '08 #37

"Richard Heathfield" <rj*@see.sig.in validwrote in message
news:NJ******** *************** *******@bt.com. ..
Then ignore them, or learn about them, at your leisure. But guessing is
just ludicrous.
When I am ready to research them I will read kandr2 or something similar
if kandr2 is too much of a mouthful, and ask if confused accordingly. but I
immediately went to wikipedia to find answers fast while online.

Bill
Sep 12 '08 #38

"Barry Schwarz" <sc******@dqel. comwrote in message
news:3u******** *************** *********@4ax.c om...
It doesn't matter whether you have ever used it or not. It is the
idiocy of guessing instead of researching that people are commenting
on.
What makes you think I am not researching things. I immediately went to
wikipedia to find out answers fast. I will read up on kandr2 when I decide
to use bitwise operators then if I am confused I will inquire here.

Bill
Sep 12 '08 #39
On Fri, 12 Sep 2008 17:33:04 -0400, "Bill Cunningham"
<no****@nspam.i nvalidwrote:
>
"Barry Schwarz" <sc******@dqel. comwrote in message
news:3u******* *************** **********@4ax. com...
>It doesn't matter whether you have ever used it or not. It is the
idiocy of guessing instead of researching that people are commenting
on.

What makes you think I am not researching things. I immediately went to
No you didn't. Your immediate response was to guess.
>wikipedia to find out answers fast. I will read up on kandr2 when I decide
You have been told repeatedly that Wikipedia is not authoritative. Why
use it when you have K&R?
>to use bitwise operators then if I am confused I will inquire here.
If you have no intention of using them in the near future, why did you
start this discussion? By your own admission, you won't remember it
when the time comes.

--
Remove del for email
Sep 13 '08 #40

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

Similar topics

14
3177
by: deko | last post by:
Do I need to use flock() when reading a file into an array? It's possible that the file in question could be open at the time the file('filename') request is made. I realize flock() is required when opening a file with fopen() when there is contention for the file: $fp=fopen($ctr, 'w'); //only write if we can get lock on file if (flock($fp, LOCK_EX)) { fwrite($fp, "0");
19
10379
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much text is available until I have read it... which seems to imply that multiple reads of the input stream will be inevitable. Now I can correctly find the number of characters available by: |
4
9842
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile = tmpfile(); /* write into tmpFile */ ...
11
3081
by: Matt DeFoor | last post by:
I have some log files that I'm working with that look like this: 1000000000 3456 1234 1000000001 3456 1235 1000020002 3456 1223 1000203044 3456 986 etc. I'm trying to read the file backwards and just look at the first column. Here's what I've got so far:
2
1439
by: archana | last post by:
Hi all, I am new to asp.net (learning phase). I have to develop application in asp.net to read file from client pc and display statistics of that file to client. So my question is that to read file from client pc do i need to upload that file on server and then start reading that file. Or is there any other alternative for this.
12
2910
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my workstation it works fine, but when I publish the page on our DEV server it doesn't fine the CSV file from the client. Has anyone done this before? If so, how do I do it? I'm new to ASP.net so
3
2186
by: miss time | last post by:
Hi all, my java friends ^-^ I have next week quiz in reading file text ,and understand the topic very well. can any one give some question related to this topic .this help me more to understand thanks a lot and sorry for inconvenience..
6
17015
by: Studlyami | last post by:
Is it possible to open a file for reading, while another process has it open for writing to it? One of the problems is that the process that is writing to it is written in C and is running on a vxworks OS. I'm reading the file using MFC on a windows XP PC. The file is stored on a Windows 2000 server. I tried using CStdioFile.Open using the CFile::modeRead flag. When did this i received a CFileException with the cause stating...
1
2143
Coldfire
by: Coldfire | last post by:
Hi, The strange problem i am having is, the input element of type='file' not reading file names after 20 file elements. It simple returns null on reading the 'name' of file. The code is simple and has no error as I am testing it standalone
1
2226
by: bjoarn | last post by:
I have an Application C# handling file reading, building index on this file, using dll wrapped with SWIG. The dll is originaly programmed in C++. Dll reports back to the the C# programm throug callback/delegates. Among others, it reports index building(%). One callback function can receive (stop order) to stop reading file/building index. How ever i do not know how to keep the stopbutton activ while this file reading is going on. I have...
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10080
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
9944
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
8968
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...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
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...
1
4044
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
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.