![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Banned
![]() ![]() |
Re: How Do I Urlencode A String In C?
Here we go. The only other thing that I can see of concern is if dest is attempted to be written to past the end of the array. But since I don't personally need to watch out for that, I'm leaving out a length restriction. I'm just warning anyone who stumbles across this thread and finds the code, to be careful that dest isn't written to past the end of the array.
C Syntax (Toggle Plain Text)
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
|
|
#12 | |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 600
Rep Power: 4
![]() |
Re: How Do I Urlencode A String In C?
When I compiled and ran your program this is what I got (VC++ 2008 Express on Vista)
Quote:
|
|
|
|
|
|
|
#13 |
|
Banned
![]() ![]() |
Re: How Do I Urlencode A String In C?
That looks right. Thanks.
![]()
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. Last edited by Sane; Mar 20th, 2008 at 2:44 PM. |
|
|
|
|
|
#14 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 648
Rep Power: 4
![]() |
Re: How Do I Urlencode A String In C?
Is there a particular reason you didn't use isalnum() from ctype.h and wrote your own?
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
#15 |
|
Banned
![]() ![]() |
Re: How Do I Urlencode A String In C?
It's C99. But I need things to be as compatible as possible. I'll also be asking you people to help me translate some snippets (this included) to Java and other languages. You guys will see why in 1 or 2 days. I think Infinate knows why.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
|
|
#16 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 648
Rep Power: 4
![]() |
Re: How Do I Urlencode A String In C?
It isn't, AFAIK. But even if it was (and I'm wrong), you could just do
c Syntax (Toggle Plain Text)
According to my man-pages, all of the functions in ctype.h are actually macros that do table lookups. They're fairly efficient (probably more so than your function), and I don't see any reason to not use them. ![]()
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
#17 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 600
Rep Power: 4
![]() |
Re: How Do I Urlencode A String In C?
No -- its been around for many many years, as far back as I remember.
|
|
|
|
|
|
#18 |
|
Banned
![]() ![]() |
Re: How Do I Urlencode A String In C?
Oh, I just checked. It isn't C99. I was just thrown off by Ooble who said "It is". Sorry.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| An Attempt at a DBMS | grimpirate | PHP | 8 | Apr 17th, 2007 2:01 PM |
| Throwing an exception when using string constructor | csrocker101 | C# | 3 | Apr 8th, 2007 3:04 PM |
| Help with breaking apart a string | csrocker101 | C# | 6 | Apr 6th, 2007 8:50 AM |
| Function Parameters | grimpirate | PHP | 10 | Mar 14th, 2007 7:55 PM |
| Problems with String to MD5 Conversion | emdiesse | Visual Basic .NET | 0 | Feb 2nd, 2006 11:25 AM |