By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 446,171 Members | 1,004 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

# How to use 64 bit integer in 16 Bit Dos ?

 P: n/a Hi .! This is my first post to this community..! I am trying to use 64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which i have data types int = 2 byte long = 4 byte float = 4 byte double =8 byte long double =80 byte Here i was trying to use double ..but i couldn,t read it from the buffer i don't know why ? Is there is any good idea to use 64 bit integer data type in dos 16..? Thanks in Advance .. Imayam Jun 15 '06 #1
Share this Question
3 Replies

 P: n/a "Imayam" writes: This is my first post to this community..! I am trying to use 64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which i have data types int = 2 byte long = 4 byte float = 4 byte double =8 byte long double =80 byte If you want a 64-bit data type, you could try char[8] (I presume CHAR_BIT==8), but I doubt that that's what you had in mind. Here i was trying to use double ..but i couldn,t read it from the buffer i don't know why ? I don't know why either. Nobody can possibly guess why if you don't show us the code. Is there is any good idea to use 64 bit integer data type in dos 16..? Oh, you want a 64-bit *integer* type. double is a floating-point type. Type long long is guaranteed to be at least 64 bits, but it might not be supported by your compiler. -- Keith Thompson (The_Other_Keith) ks***@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this. Jun 15 '06 #2

 P: n/a Keith Thompson wrote: "Imayam" writes: This is my first post to this community..! I am trying to use 64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which i have data types int = 2 byte long = 4 byte float = 4 byte double =8 byte long double =80 byte If you want a 64-bit data type, you could try char[8] (I presume CHAR_BIT==8), but I doubt that that's what you had in mind. Here i was trying to use double ..but i couldn,t read it from the buffer i don't know why ? I don't know why either. Nobody can possibly guess why if you don't show us the code. Is there is any good idea to use 64 bit integer data type in dos 16..? Oh, you want a 64-bit *integer* type. double is a floating-point type. Type long long is guaranteed to be at least 64 bits, but it might not be supported by your compiler. -- Keith Thompson (The_Other_Keith) ks***@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this. Hi ..Thanks you ..thanks a lot..:) I don't know why either. Nobody can possibly guess why if you don't show us the code. Sorry ....I am not writing any code as of now but my basic need is this ,i want to handle 64 bit data so I just written some test program..that has nthg to do i have given my code below memcpy(&Test1,&Buf[30],8); //I am trying to copy 64 bit data from buffer val1 = my_atof(Test1,8); //I am using function which will convert this to double printf("\n val1=%lf",val1); //////////////////////////////////// double my_atof(char *src, int len) { double result = 0; char tmp,str[32],str1[32],*endptr; int i,j; memset(str1,NULL,32); for (i = 0,j=len; i <=len; i++,j--) { tmp =(int) src [j]; itoa(tmp,str,10); strcat(str1,str); } str1[32]='\0'; printf("\n STRc = %s ",str1); result = strtod(str1,&endptr); printf("\n RESLUT = %lf",result); return result; } ////////////////////////////////// Actually I was trying to perform above function it is also not working for me... Consider the memory area ..It is Little Endian 0x30 : C0 19 00 00 00 00 00 00 00 00 00 00 00 00 00 ----------------------------------- if I copy the value to my variable using --> memcpy(&Test1,&Buf[30],8); i wil get Test1[0] = 0xC0 Test1[1]=0x19; Test1[1]=0x00; etc.... i calling function ........... val1 = my_atof(Test1,8); { tmp =(int) src [j]; //In first routine i will get 0,0,0,0,0,0,25,192 itoa(tmp,str,10); //I have to convert it to string Other wise it will take this as //Ascii Value...so my str contains ="192" strcat(str1,str); //Concatinating the string } at the End of the Loop i have string ---> 25192 result = strtod(str1,&endptr); if i convert this into double -------------> i Will get 25192.00000 but the Required Output is -----------> 6592. More over it is time consuming function. So i want to handle 64 Bit Data Type effectively . so How can i achive this ..?? Regards Imayam Jun 15 '06 #3

 P: n/a On 15 Jun 2006 04:41:30 -0700, in comp.lang.c , "Imayam" wrote: Consider the memory area ..It is Little Endian0x30 : C0 19 00 00 00 00 00 00 00 00 00 00 00 00 00 ....at the End of the Loop i have string ---> 25192 ....but the Required Output is -----------> 6592. This isn't a C question, its all about algorithms and data storage. Sit down with a pencil and paper, and work out how your platform is storing the data, so that you can work out how to read it correctly. THEN write an algorithm to perform that read. For more advice, I'd suggest comp.programming or one of the DOS groups. -- Mark McIntyre "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan Jun 15 '06 #4

### This discussion thread is closed

Replies have been disabled for this discussion.