July 24, 2003
Gentlemen,

I'm hoping I can move into a higher level of programming: creating programs that solve practical problems. I'm hoping you may be able to help me to advance to this next level.

I have a maintenance management system that spits out information in csv (comma separated value) format (with or without table headers), which is largely unusable to me and my comrades. I'd like to import and rearrange that information into a format that makes sense to maintenance managers. My first thought was to use a struct to read in individual records, reformat the information, and transfer to an output file.

Will I have to read and examine each character until I encounter a comma? Is there a way to read information and use the comma as a delimiter instead of a whitespace?

What would be the best way to attack this problem?

I would love to provide a sample of what I'm looking at, however, that is not possible. The best I can do is to say that everything in the file can be treated as characters and all required calculations are independent of information contained therein.

If I am too vague, I'm sorry, and unfortunately, will have to do without the advice.

Thanks in advance,
Andrew


July 24, 2003
import stream;
import string;

void main() {
    File fin = new File("test.txt",FileMode.In);

    while (!fin.eof() ) {
        char [] [] elements = split(fin.readLine(),",");
        // re-arrange
    }
}

// elements.length contains the number of elements, a simple for loop can
reverse
// the order etc


// Charles


"Andrew Edwards" <edwardsac@spamfreeusa.com> wrote in message news:bfnbl5$2k8u$1@digitaldaemon.com...
> Gentlemen,
>
> I'm hoping I can move into a higher level of programming: creating
programs
> that solve practical problems. I'm hoping you may be able to help me to advance to this next level.
>
> I have a maintenance management system that spits out information in csv (comma separated value) format (with or without table headers), which is largely unusable to me and my comrades. I'd like to import and rearrange that information into a format that makes sense to maintenance managers.
My
> first thought was to use a struct to read in individual records, reformat the information, and transfer to an output file.
>
> Will I have to read and examine each character until I encounter a comma?
Is
> there a way to read information and use the comma as a delimiter instead
of
> a whitespace?
>
> What would be the best way to attack this problem?
>
> I would love to provide a sample of what I'm looking at, however, that is not possible. The best I can do is to say that everything in the file can
be
> treated as characters and all required calculations are independent of information contained therein.
>
> If I am too vague, I'm sorry, and unfortunately, will have to do without
the
> advice.
>
> Thanks in advance,
> Andrew
>
>