Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 27th, 2005, 03:52 PM
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default splitting large value 2^24


i am trying to split a variable key1[2] into to 2. key1[0] should equal 256 which is 0x00000100 and key1[1] should equal 65356 which is 0x00010000 in hex. i keep getting a segmentation fault:

i have the following code:

#define SIZE 16777216

typedef struct
unsigned short poskey[2];
unsigned short text[2];

int main(int argc, char *argv[])
unsigned short key1[2], key2[2];
unsigned short p[2], c[2];

str res[SIZE];
str dec;
str *result;

for (i=0; i < SIZE; i++)
key1[0] = i & 0x00000100;
key1[1] = (i & 0x0010000);
encode(p, key1);
res[i].poskey[0] = key1[0];
res[i].poskey[1] = key1[1];
res[i].text[0] = p[0];
res[i].text[1] = p[1];

can any body help, i have know idea what to do

thanks in advanced


Reply With Quote

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 2 pg 24 "Using the Properties..." LuluDev BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 January 23rd, 2006 09:12 AM
Tomcat3.3.2 to Tomcat5.0.24 amith_pj Apache Tomcat 2 July 10th, 2005 04:23 AM
Tomcat3.3.2 to Tomcat5.0.24 amith_pj Servlets 1 August 11th, 2004 01:12 AM
How to show 24 Hour Time? Edward King Oracle 1 July 31st, 2004 04:44 AM
Code of Chapter 24 qazi_nomi BOOK: Beginning ASP 3.0 0 June 23rd, 2004 11:48 PM

All times are GMT -4. The time now is 01:00 PM.

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