Member Avatar for Josue198s

guys how to slpit a date string ie....30/jully/2001

i want the following output
30
jully 2001


please help...

We only give homework help to those who show effort.

Look up the strtok function.

guys how to slpit a date string ie....30/jully/2001

  1. Read the date into a char array (from the user or a file or wherever).
  2. A date can have a simple and strict format, so you can specify a few acceptable ones and compare the input to those.
  3. Go through the array one character at a time and copy the respective parts to new arrays for the day, month and year.
  4. Done. output the result.

Have a go at doing something like that and then see how you get on. If you have further problems, then post the code that you've written and explain what errors you have in a bit more detail.

we can use spit() which can be used to split a char array using a delimiter

we can use spit()

In what library? That's not in the Standard C library for sure.

sorry
then its better to use strtok as said by narue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.