Article View: alt.comp.programming
Article #5need help - formatting input
From: Psybar Phreak
Date: Mon, 20 Jan 2003 09:20
Date: Mon, 20 Jan 2003 09:20
23 lines
1965 bytes
1965 bytes
hi all.... hope someone can lend me a little help on a problem im working
on
background desc : program can take either
1) Two dates in the format (yyyymmdd) through stdin, or
2) One date in the format (yyyymmdd) and a single number (up to 7 digits
long)
firstly i was thinking about using scanf("%03d, %01d, %01d", &year, &month,
&day); but that will only work in case 1 where there's two dates
sooo.... does anyone know a way, in which i could just save the 2 inputs as
separate int's, run a check on the length of it, then, if its a date, break
it into pieces so i get the year in one variable, the month in another, and
the day in another?!??!
what do you think? would this be the easiest way about it or am imissing
something a lot easier?
thanks everyone
daina
sydney, australia
Technical Details
Message-ID:
<3e2bbf5d$0$7813$afc38c87@news.optusnet.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!t-online.de!snewsf0.syd.ops.aspac.uu.net!news1.optus.net.au!optus!spool01.syd.optusnet.com.au!spool.optusnet.com.au!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10dce5,e57a7de65360e87c,start X-Google-Attributes: gid10dce5,public X-Google-Thread: 108717,e57a7de65360e87c,start X-Google-Attributes: gid108717,public X-Google-Thread: fb361,e57a7de65360e87c,start X-Google-Attributes: gidfb361,public X-Google-ArrivalTime: 2003-01-20 01:25:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!t-online.de!snewsf0.syd.ops.aspac.uu.net!news1.optus.net.au!optus!spool01.syd.optusnet.com.au!spool.optusnet.com.au!not-for-mail From: "Psybar Phreak" <gotyoubacktoo@yahoo.com> Newsgroups: alt.comp.programming,aus.students,comp.programming Subject: need help - formatting input Date: Mon, 20 Jan 2003 20:20:28 +1100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Lines: 25 Message-ID: <3e2bbf5d$0$7813$afc38c87@news.optusnet.com.au> NNTP-Posting-Host: 211.28.166.123 X-Trace: 1043054429 7813 211.28.166.123