kvarnerexpress
Feb 28 2006, 01:30 PM
| | From the environment variables, i get the domain of the referring site using SERVER_NAME. The includes www. and i have to remove that. I dont believe there is a variable in the environment that contains only the domain.
So I would need to replace each character in the char* string by "" until i hit a '.' then replace the dot with "" and get the remaining string. Here is the catch. I can't include big headers because i need the file to stay really small around 20-30kb. So ideally, would need to use functions in stdlib.h stdio.h or string.h to get this done.
Thanks in advance |
Reply
kvkv
Mar 2 2006, 10:44 AM
Here is an easy solution for your problem.
CODE
{servenv++;}while((*servenv)!='.'); //increment char* till next character to '.'
//use servenv here. it points to next character of the first '.'
Reply
Similar Topics
Keywords :
removing characters- Isolating Integers From Characters?
- (4)
- Weird Characters Appending To File
- (2)
Anytime I open a file and close it without changes, weird characters show up. Here is the code:
PHP Code: inFile = fopen("serefs.dat","rb"); outFile = fopen("tempfile.dat","wb"); while
(!feof(inFile)) { char line ; char timeline ; fgets(line,512,inFile);
strncpy(timeline, line, 10); timeline = '\0'; int filetime;
filetime = atoi(timeline); if(filetime > (realtime - 86400)) {
fputs(line,outFile); } } fclose(inFile); fclose(outFile); //Put tempfile in buffe...
Looking for removing, characters