Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[prog-challenge] In-Place URL Encoding

Name: Anonymous 2009-01-17 7:23

Using the encoding ranges specified in the following function

URLencode(char *out, char *in) {
 char a;
 while((a=*in)) {
  if((a>='A')&&(a<='Z')||(a>='a')&&(a<='z')||(a>='0')&&(a<='9')||(a=='-')||
     (a=='_')||(a=='.')||(a=='~')) {
   *(out++) = a;
  } else {
   sprintf(out,"%%%02x",a);
   out+=3;
  }
  in++;
 }
 *out=0;
}


Write an equivalent function which can URL-encode a string in-place, i.e. assuming the buffer is large enough (thrice the length of the original string), a call such as URLencode(str) will write the URL-encoded version in the same buffer, possibly lengthened to up to thrice its original length.

Your function cannot use any additional storage space that grows proportionally with the length of the string. The smallest, fastest, and most efficient implementations win.

Name: Anonymous 2009-01-17 10:35

>>18
Let's say you have to take an exam. Your task is: "Create a class that acts as an dynamic array, similar to the vector of the STL".
As the FrozenVoid you are, you would just ignore the task and use #include <vector>. Failure to accomplish the task, meaning you won't pass your exam. Well done, smartass.

>>21
I can't help it. I have to find out if he is just trolling or if he really is that stupid.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List