0

I am trying to extract the query and the extension from request-line but i don't know what's the maximum length of a query and a file extension so that I can know the size of the char array to store them.

  • The challenge is to extract query from the requested target. We know where the string containing the request begins and can find where the ? appears in that string, right? Take that information and combine it with the length of the string containing the request and one should be able to calculate how long the query is. Something similar can be done re: file extension. – lyflonglerner Oct 15 '15 at 0:54
0

When setting the length of your char array for say query[] or extension[], you can include a calculation or formula in between the brackets to find the size it needs to be. That's something I didn't know when I did this problem. You can even include a condition between the brackets. The easiest way to write this in one line is with the condition ? true : false notation.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .