I have two problems where I'm having a hard time to understand.
1) I'm having a hard time to understand how to pass my L1 doublyLinkedList into an array so that I can save each list of numbers my txt file reads
2) If I have an uneven negative number my break_into_nodes() method is reading an error as stoi is creating 1 node for a negative sign, how would I create an if statement to continue to breaking it into a node
#include "stdafx.h"
#include <iostream>
#include <iterator>
#include <fstream>
#include <string>
#include <cstdlib>
#include "ArgumentManager.h"
using namespace std;
struct Node
{
    long long value;
    Node *next, *prev;
    Node(long long y)
    {
        value = y;
        next = prev = NULL;
    }
};
class doubleLinkedList
{
    Node *back;
public:
    Node *front;
    doubleLinkedList() { front = NULL; back = NULL; }
    ~doubleLinkedList() { destroyList(); }
    doubleLinkedList(const string& num, int digitsPerNode) {
        appendNodeFront(stoi(num, 0, 10));
    }
    void appendNodeFront(long int x);
    void dispNodesForward(int digits);
    void destroyList();
    void clean();
};
void doubleLinkedList::clean()
{
    destroyList();
}
void doubleLinkedList::appendNodeFront(long int x)
{
    Node *n = new Node(x);
    if (front == NULL)
    {
        front = n;
        //back = n;
    }
    else
    {
        front->prev = n;
        n->next = front;
        front = n;
    }
}
void doubleLinkedList::dispNodesForward(int digits)
{
    Node *temp = front;
    int temp_val;
    if (temp != NULL)
    {
        /* First node does not get Zero padding */
        temp_val = (int)temp->value;
        printf("%d", temp_val);
        temp = temp->next;
        while (temp != NULL)
        {
            temp_val = (int)temp->value;
            printf("%0*d", digits, temp_val);
            temp = temp->next;
        }
    }
}
void doubleLinkedList::destroyList()
{
    Node *T = back;
    while (T != NULL)
    {
        Node *T2 = T;
        T = T->prev;
        delete T2;
    }
    front = NULL;
    back = NULL;
}
void break_into_nodes(doubleLinkedList *list, string number, int digits) {
    string  node_value;
    int     num_index, num_iterations;
    int     i, j;
    num_index = number.length();
    if (num_index < digits)
    {
        node_value = number;
        list->appendNodeFront(stoi(node_value));
    }
    else {
        /* adjust for incomplete nodes */
        if ((number.length() % digits) == 0)
            num_iterations = (number.length() / digits);
        else
            num_iterations = (number.length() / digits) + 1;
        for (j = 0; j < num_iterations; j++) {
            node_value.clear();
            for (i = 0; i < digits; i++) {
                num_index--;
                if (num_index < 0)
                    break;
                node_value = node_value.insert(0, number.substr(num_index, 1));
            }
            list->appendNodeFront(stoi(node_value));
        }
    }
}
// Driver program
int main(int argc, char* argv[]) {
    doubleLinkedList l1;
    if (argc < 2) {
        cerr << "Usage: infinitearithmetic \"input=xyz.txt;digitsPerNode=    <number>\"\n";
    }
    ArgumentManager am(argc, argv);
    string filename = am.get("input");
    /* Digits per Node ar from 1 to 8 */
    int digitsPerNode = stoi(am.get("digitsPerNode"));
    ifstream ifs(filename.c_str());
    string line;
    string num1;
    int i = 0;
    while (!ifs.eof())
    {
        getline(ifs, line);
        //cout << "" << line << endl;
        num1 = line;
        break_into_nodes(&l1, num1, digitsPerNode);
        l1.dispNodesForward(digitsPerNode);
        cout << endl;
        l1.clean();
        i++;
    }
    return 0;
}
 
    