Peter Djeneralovic
Peter Djeneralovic

Reputation: 507

Reading a vcf file into an array of strings

Below is a method I call to try and read in a vcf file line by line into an array of strings.

    internal static void splitUpFile(String fileLocation)
    {
        string[] file = System.IO.File.ReadAllLines(fileLocation);


        System.Console.WriteLine("Contents of contacts.vcf =:");
        foreach (string line in file)
        {
            Console.WriteLine("\t" + line);
        }


        Console.WriteLine("Press any key to exit.");
        System.Console.Read();

    }

Now I want to split the array into three other vcf files, which are created dynamically and placed in the same directory as the one that has been read in? Is this possible?

Upvotes: 0

Views: 1318

Answers (1)

Rashedul.Rubel
Rashedul.Rubel

Reputation: 3584

To appear and keep open console use

Console.ReadLine();

at the last line.

To create other vcf file using the step as below:

1. create a directory
2. create a file with .vcf extension in that directory
3. write data to and read data from that created file kept in the specified directory

Upvotes: 0

Related Questions