Hello, i am a newbie.
Now i got a problem about Extracting some specific strings from a txt file.
Here is the txt file like:

121348319B'\t'Herman Gerrand'\t'ED001' 'C'\t'ED002' 'A
ED003' 'B'\t'ED004' 'C
124311431B'\t'Shakes Hand'\t'ED021' 'F'\t'ED003' 'C
ED007' 'A'\t'ED011' 'B
124134131B ....go on

The sequence logic is: student ID'\t'student name'\t'subject code' 'subject grade'\n'

The problem is how can i extract only the name to make a student name list?

I have searched a lot and still cant get help, so i am here.
Thank you for helping.

Using visual studio 2010express

Recommended Answers

All 3 Replies

Here's an article that discusses several options for splitting string in c++.

Sorry i am stupid. I still can't get anything from that article.
Would you mind please do an example for me?

#include <stdio.h>
#include <string.h>

int main()
{
  char s[] = "one, two,, four , five,"; /* mutable! */
  const char* p;

  for (p = strtok( s, "," );  p;  p = strtok( NULL, "," ))
  {
    printf( "\"%s\"\n", p );
  }

  return 0;
}
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.