Mailinglist Archive: opensuse (4053 mails)

< Previous Next >
[SLE] splitting a string
  • From: Jesse Marlin <jesse.marlin@xxxxxxxxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 9 Aug 2001 09:39:29 -0400
  • Message-id: <15218.37521.626059.684506@xxxxxxxxxxxxxxxx>
Jesse Marlin writes:
> S.Toms writes:
> > Quick question for everyone, I want to beable to split a string that
> > contains a colon at the colon, for example
> >
> > 4.23.242.12:2323
>
> In C or C++:
>
> char ip[50];
> int port;
>

Whoops a typo:

cnt = sscanf (buf, "%[^:]:%d", ip, &port);

>
>
>
> >
> > I'd like to remove the colon and whatever follows it. Unfortunately, I
> > havn't figured out a way to do it with what I know.
> >
> > --
> > S.Toms - smotrs@xxxxxxxxxxxxxx - www.mindspring.com/~smotrs
> > SuSE Linux v7.0+ - Kernel 2.2.18
> >
> > Silverman's Law:
> > If Murphy's Law can go wrong, it will.
> >
> >
> > --
> > To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
> > For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
> > Also check the FAQ at http://www.suse.com/support/faq and the
> > archives at http://lists.suse.com
>
>
> --
> To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
> For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
> Also check the FAQ at http://www.suse.com/support/faq and the
> archives at http://lists.suse.com



--
Jesse Marlin
Intec Telecom Systems
Software Engineer
Main 404-705-2800
Ph 404-705-2912
Fax 404-705-2805
Email jesse.marlin@xxxxxxxxxxxxxxxxxxxxxxxxx

< Previous Next >
Follow Ups
References