Hello all. pls dont shoot me down yet.
I'm trying to read the first 5 char from a string array
example name[20];
the string is already stored;
how do i read only the first 5 char say for validation.
pls help.
sene
Hello all. pls dont shoot me down yet.
I'm trying to read the first 5 char from a string array
example name[20];
the string is already stored;
how do i read only the first 5 char say for validation.
pls help.
sene
they would be stored in:
name[0]
name[1]
name[2]
name[3]
name[4]
This is assuming you meant char array and not string array:
char name[20];
Also make sure none of the first 5 are the '\0' character if you're expecting your string length to be 5 or greater.
Try not.
Do or do not.
There is no try.
- Master Yoda
sorry i'm refering to string array.
hope its not too much bother 'Green yoda'
>>sorry i'm refering to string array.
In C, the term string normally refers to an array of type char, where the contents is null terminated. What are you refering to?
>>hope its not too much bother 'Green yoda'
What other colour would you expect Yoda to be?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
thanks master yoda and hammer, i have solved it
with your help
hihihi
cheers