- Code: Select all
int getPos(char *source, int start)
{
char path[256];
int tmp;
strcpy(path, source);
tmp = path[start] << 8;
return path[start + 1] + tmp;
}
void setPos(char *dest, int start, int value)
{
char path[256];
char f, s;
strcpy(path, dest);
f = (value & 65280) >> 8;
s = value & 255;
path[start] = f;
path[start + 1] = s;
strcpy(dest, path);
}