So how is your CNC machine going to know whether you stored the whole thing in one massive array, or output them individually?
> 64k is just 304 mm of movement of the machine whereas I need at least 2000 mm.
Like who cares that it travels 300mm, appears to pause for a moment, then moves another 300mm. Your PC is so fast that you might not even notice.
Does your CNC machine store the whole program first, then only does things when you send a 'go' command? If so, there is absolutely no reason I can see to complicate the sending of the data by trying to create large arrays on your restricted OS.
> I have run the program on Pentium1/dos5, Pentium1/dos6.2
> and P4/XP machines.
If XP is a real choice, then get a better compiler. Any modern 32-bit compiler suitable for XP would have no trouble at all dealing with a couple of MB of array size.
Since you're using C++, maybe create a small class to do some work for you, by providing some kind of simulation of a large array?
#include <iostream>
using namespace std;
const int BLOCK_SIZE = 50000;
class bigA {
private:
char **m_array;
size_t m_size;
size_t m_blocks;
public:
bigA( size_t size );
~bigA( void );
char & operator [] ( unsigned int i );
};
bigA::bigA ( size_t size ) {
m_size = size;
m_blocks = size / BLOCK_SIZE;
if ( size % BLOCK_SIZE != 0 ) m_blocks++;
m_array = new char*[m_blocks];
for ( size_t i = 0 ; i < m_blocks ; i++ ) {
m_array[i] = new char[BLOCK_SIZE];
}
}
bigA::~bigA ( void ) {
for ( size_t i = 0 ; i < m_blocks ; i++ ) {
delete [] m_array[i];
}
delete [] m_array;
}
char & bigA::operator [] ( unsigned int i ) {
if ( i < m_size ) {
size_t row = i / BLOCK_SIZE;
size_t col = i % BLOCK_SIZE;
return m_array[row][col];
}
// panic now, out of bounds
}
int main ( ) {
bigA foo(123456);
foo[1234] = 'a';
cout << foo[1234] << endl;
return 0;
}