char[n] to int ?
-
Im helping out someone with this problem and im stuck, it been sometime since i used c++. He reads in a file (ios::binary) and char version [30]; // ... file.get(version, 30); Now the in version[0] is a char value, i want the decimal value, for example, 0x18 is "cancle" (looks like a up arrow in text). I want the decimal value 24 from 0x18, or take the char "cancle" and get 24. the reason i need the decimal value is because it represents the lenght of the data string after version[0]. 30 is the max the string can be so thats why i need the decimal value of version[0]. Its just to tell the user what version the file being read is. Can anyone help me on this? Thanks.
-
Im helping out someone with this problem and im stuck, it been sometime since i used c++. He reads in a file (ios::binary) and char version [30]; // ... file.get(version, 30); Now the in version[0] is a char value, i want the decimal value, for example, 0x18 is "cancle" (looks like a up arrow in text). I want the decimal value 24 from 0x18, or take the char "cancle" and get 24. the reason i need the decimal value is because it represents the lenght of the data string after version[0]. 30 is the max the string can be so thats why i need the decimal value of version[0]. Its just to tell the user what version the file being read is. Can anyone help me on this? Thanks.
int length = (int)version[0]; cout << "value should be 24 <" << length << ">" << endl;
-
int length = (int)version[0]; cout << "value should be 24 <" << length << ">" << endl;
Thanks. I swear i though i tried that but had an error and wrote if off. :) edit: Well it wasnt an error but a '0'. When i run it through VS2005 i get a zero, but when i go to the .exe and double click it i get 24. Thats why i wrote it off i dont get the right values when running through VS2005. IT was driving me nuts out of the blue i double click the .exe and bam it works. dang VS2005 -- modified at 1:50 Monday 31st July, 2006
-
Im helping out someone with this problem and im stuck, it been sometime since i used c++. He reads in a file (ios::binary) and char version [30]; // ... file.get(version, 30); Now the in version[0] is a char value, i want the decimal value, for example, 0x18 is "cancle" (looks like a up arrow in text). I want the decimal value 24 from 0x18, or take the char "cancle" and get 24. the reason i need the decimal value is because it represents the lenght of the data string after version[0]. 30 is the max the string can be so thats why i need the decimal value of version[0]. Its just to tell the user what version the file being read is. Can anyone help me on this? Thanks.
-
codeguru again ??!! :((
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
codeguru again ??!! :((
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
Hello Mr toxcct, How are you?did you have a good weekends? I can say only ::-O and i say again, Viens,laissons l'Avenir;laissons nos chagrins fous. Jouissons du present et si doux!(Khayyam)
_**
**_
WhiteSky