From: hArLeQuIn Newsgroups: comp.os.msdos.djgpp Subject: Re: Some qusestions Date: Wed, 14 Jan 1998 23:20:56 +0100 Organization: Abacom-Internet GmbH & Co Lines: 48 Message-ID: <34BD3A47.54FE8849@quakeforum.de> References: <34BCDB23 DOT 6A22 AT wxs DOT nl> <34BD069B DOT 2FE5 AT cornell DOT edu> Reply-To: harlequin AT quakeforum DOT de NNTP-Posting-Host: dialin29.detmold.netsurf.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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