View Single Post
Old Oct 19th, 2004, 4:46 PM   #14
sys0p
Programmer
 
Join Date: Oct 2004
Posts: 73
Rep Power: 5 sys0p is on a distinguished road
Quote:

Yes but only if the name has been defined as char, uint8 and so on...
(i.e. char name[100]
However if the name has been defined as int (i.e. int name[100])
then it would look like this:

name[0]=0x1000
name[1]=0x1002
name[2]=0x1004

explanation:
unsigned char takes one byte and can hold value between 0 and 255 (2^8)
unsigned int takes two bytes and can hold value between 0 and 65536 (2^16)
unsigned double takes 4 bytes ... and so on.
signed versions have the same field of values but it starts with -max/2 and ends with max/2
(i.e. min = -128 max =128)

OK dude, I see! Ta for explaining!

Quote:

-max/2 and ends with max/2
You mean -min/2 ...

It's OK. I know you are tired!

Quote:

btw.
I'm absolutly fascinated with your avatar.
Yeah it's a fine one!

And just to make sure I understand, is this right:

If we run the following on the command line:

myBigProgram.exe -l 66 -n program.txt

It will look like this:

argc = 5
argv[0] = "myBigProgram.exe";
argv[1] = "-l"
argv[2] = 66
argv[3] = "-n"
argv[4] = "program.txt"

argv[0][0] = 'm'
argv[0][1] = 'y'
argv[0][2] = 'B'
argv[0][3] = 'i'
argv[0][4] = 'g'
argv[0][5] = 'P'
argv[0][6] = 'r'
argv[0][7] = 'o'
argv[0][8] = 'g'
argv[0][9] = 'r'
argv[0][10] = 'a'
argv[0][11] = 'm'
argv[0][12] = '.'
argv[0][13] = 'e'
argv[0][14] = 'x'
argv[0][15] = 'e'

argv[1][0] = '-'
argv[1][1] = 'l'

argv[2][0] = '6' //Is this right, it is a number
argv[2][1] = '6' //Is this right, it is a number

argv[3][0] = '-'
argv[3][1] = 'n'

argv[4][0] = 'p'
argv[4][1] = 'r'
argv[4][2] = 'o'
argv[4][3] = 'g'
argv[4][4] = 'r'
argv[4][5] = 'a'
argv[4][6] = 'm'


I have a feeling this isn't right?

Anyway, thanks guys for your replies! Very much appreciated!
Cheers!

Quote:

My mistake!
What's that?
sys0p is offline   Reply With Quote