From: Tron Newsgroups: comp.os.msdos.djgpp Subject: Re: example of sscanf function Date: Thu, 6 Nov 1997 16:22:20 +0100 Organization: Instituto Superior Tecnico Lines: 42 Message-ID: References: <345B78DF DOT 53B722B1 AT netcom DOT ca> NNTP-Posting-Host: alfa.ist.utl.pt Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <345B78DF.53B722B1@netcom.ca> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sat, 1 Nov 1997 jb AT netcom DOT ca wrote: > > could anyone please give me an example of how to use the sscanf > function? > examples: char Buffer[100]; int Inteiro; char Rest_of_Buffer[60]; void main(void) { sscanf(Buffer, "%s %d %[^\n]", First_arg, Inteiro, Rest_of_Buffer); } you write to Buffer the string -> " hello 13242 !@# garbage " this gives you this result: First_arg -> "hello" Inteiro ->13242 Rest_of_Buffer ->"!@# garbage " sscanf, scanf and fscanf, they are very powerfull functions... special for shells and parsing... ps: sorry my english, its not my native language... by: RCCo... | web page -> http://alfa.ist.utl.pt/~l42794 \ e-mail ---> l42794 AT alfa DOT ist DOT utl DOT pt ------------------------------------------- end of line.