delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/14/17:30:42

From: hArLeQuIn <harlequin AT quakeforum DOT de>
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019