Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2005, 11:16 PM
ck ck is offline
Authorized User
 
Join Date: Dec 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default any1 can help me, pls...

hi,
 do any1 know how to convert 255 to binary 1? i doing graphic programming now...so the image is in 8 bits(binary form), but althoughthe image is in binary form, but the value still is 0 - 255...so, i wan to convert octal 255(8 bits) to binary 1(which is 255 equal to binary 1) & 0 is equal to binary 0...so, do any1 know how to convert it??? thanks a lot...
 i rushing this...so, hope i can hear from u soon...

best regards,
ck


__________________
ck.
 
Old February 23rd, 2005, 09:02 PM
Authorized User
 
Join Date: Feb 2004
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure what you mean. Something like one of these?

Code:
#include <stdio.h>

int main()
{

  unsigned char x0; /* could be other int data type */
  unsigned char x1; /* could be other int data type */
  unsigned char y0; /* could be other int data type */
  unsigned char y1; /* could be other int data type */
  unsigned char z0; /* could be other int data type */
  unsigned char z1; /* could be other int data type */

  x0 = 0;
  x1 = 255;

  y0 = x0 & 1;       /* bit operation on lsb */
  y1 = x1 & 1;       /* bit operation on lsb */

  z0 = (x0 == 255);  /* logic operator */
  z1 = (x1 == 255);  /* logic operator */

  printf("x1 = %3d (0x%02x hex), x1 = %3d (0x%02x hex)\n", x0, x0, x1, x1);

  printf("y0 = %3d (0x%02x hex), y1 = %3d (0x%02x hex)\n", y0, y0, y1, y1);

  printf("z0 = %3d (0x%02x hex), z1 = %3d (0x%02x hex)\n", z0, z0, z1, z1);

  return 0;
}
Regards,

Dave





Similar Threads
Thread Thread Starter Forum Replies Last Post
MSI Installer Problem ... any1 help? hamkachan General .NET 0 March 23rd, 2008 09:12 PM
Any1 have a TBH CustomEvents Source? krainov BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 28th, 2007 01:54 AM
Can any1 help me out prashanth_a18 C++ Programming 1 September 26th, 2006 05:09 PM
any1 can help me, pls... ck C++ Programming 1 February 24th, 2005 07:51 AM
Can any1 help me?! Garri Visual C++ 1 July 6th, 2004 01:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.