I'm working on an assignment and I've run into a small problem. Our teacher wants us to read a line from a file containing three things we need sperated by a whitespace. I'm trying to figure out the cleanest way to read the line and then break it into the three parts, add each seperate element to an array and a textbox control.

so for example, the first readline would give:
Dustin 90 A

I only need to do this five times, so I know I'm using two nested loops, the first set to a 5 count, the second to a three count, but I really don't want to check each individual char. Any help?

I know what to do once I get it broken up, the three values will be sent to their respective textbox control and I can populate the respective arrays as well, but this is going to be a pain if I have to read every char looking for a whitespace. :|

Recommended Answers

All 3 Replies

Thank you so much! I can't believe there is nothing about this in my textbook for this chapter. I'm getting ripped off :|

I can't believe there is nothing about this in my textbook for this chapter. I'm getting ripped off

Perhaps. But maybe the intent of the lesson was to teach you the value of a function to perform a common task. You had previously demonstrated that you had thought out the necessary steps to write your own function. If your teacher is any good, I bet that he/she would be more impressed by a function that your developed on your own than by using a pre-written one.

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.