Mail Archives: djgpp/1998/01/14/17:30:42
A. Sinan Unur wrote:
> Nils van den Heuvel wrote:
> > And how do cut this string into little pieces:
> >
> > set ultrasnd=220,1,1,11,5
> > (it's an environment variable)
> >
> > i want to get these pieces:
> > 220
> > 1
> > 1
> > 11
> > 5
> >
> > in a variable of their own....
> > Can someone help me with this?
>
> you can use strspn to parse the string.
>
> -- Sinan
or you take a look at scanf( ). Its the opposite of printf( ) and reads
data from a string.
say, this String is "220,1,1,11,5" and named str
define some vars adr, irq, dma etc and read data like this:
sscanf(str,&adr,&irq,&dma, [...]); -> string scanf
read GNU 'info' for details
--
`°¤ø,¸¸¸,ø¤°`°¤ø,¸¸,ø¤°` harlequin AT quakeforum DOT de
`°¤ø,¸¸,ø¤°`°¤ø,¸¸¸,ø¤°`
?¿? Hâ®léqùîn of Deathcompany Ltd & qub software inc ?¿?
Deathcompany Ltd at
http://www.quakeforum.de/deathcom
qub software at
http://www.quakeforum.de/qub/
soon: www.qub.com
- Raw text -