1
Window / Re: [Linux] pollEvent is slow / disable joystick
« on: August 21, 2012, 09:40:15 pm »
Woops, sry, in the posted code is an error:
The + 13 was left over from some experiments. +2 instead of +1 for array size is because of http://stackoverflow.com/a/5926044 (See comments),
char filename[13 /* For /dev/input/js */ + std::numeric_limits<unsigned int>::digits10 + 1 /* Null termination */];
std::sprintf(filename + 13, "/dev/input/js%u", index);
must bestd::sprintf(filename + 13, "/dev/input/js%u", index);
char filename[13 /* For /dev/input/js */ + std::numeric_limits<unsigned int>::digits10 + 2 /* Null termination */];
std::sprintf(filename, "/dev/input/js%u", index);
std::sprintf(filename, "/dev/input/js%u", index);
The + 13 was left over from some experiments. +2 instead of +1 for array size is because of http://stackoverflow.com/a/5926044 (See comments),