如何将.txt文件按空格分割写入string数组

写了这么一串代码:

#include <iostream>
#include <fstream>

int main()
{
    using namespace std;

    /*获取正在运行程序的列表,并输出为.txt*/
    system("tasklist > \"%userprofile%\\Local Settings\\Temp\\tasklist.txt\"");
    
    /*打开.txt*/
    const char* address = "%userprofile%\\Local Settings\\Temp\\tasklist.txt";
    ifstream readTaskList;
    readTaskList.open(address);

    /*读取行数*/
    char i;
    int line{};
    while (readTaskList.get(i))
    {
        if (i == '\n')
            line++;
    }
    line++;
    line = line * 6;  //tasklist每一行会输出6串空格,前两行除外,为保险起见多留几个
    
    /*读取每一个数据(用空格分隔)并写入数组*/
    string temp;
    string* a = new string[line];    //1
    while (!readTaskList.eof())
    {
        int i{ 1 };
        readTaskList >> temp;
        a[i] = temp;
        i++;
    }

    cout << a;    //2

    return 0;
}

1的位置可以正常运行(在哪一行后添加cout << "xxx";可以输出),但我始终得不到数组a的输出。
.txt里有一些是一连串空格,比如说这几行

img


int main()
{
    FILE* f = fopen("C:/Users/zhang.lei/Desktop/2.txt","r");
    if (f == NULL) return 0;
    char s[20] = { 0 };
    while (fscanf(f,"%s",s) != EOF)
    {
        //printf("%s\n",s);
        string ss(s);
        //memset(s,0,sizeof(s));
        cout << ss <<endl;
    }
    
}

用字符串流stringstream