If you're programming in C, then:
strncpy( q, p, 499 );
q[499] = '\0';
will do the trick and work however long the string is. If you'd like to obfuscate things a bit more then you can combine the two lines into one by exploiting the return value of strncpy:
strncpy( q, p, 499 )[ 499 ] = '\0';
I wouldn't use the single line version unless you want extreme sarcasm deployed in code reviews. And a few cross eyed maintenance programmers.
Cheers,
Ash