|
-
March 22nd, 2012, 12:33 PM
#8
Registered User
 Originally Posted by NooNoo
[headache]pointers[/headache]
In all honesty, understanding them as "theory" in the absence of good examples is a headache that makes no sense, but when you start using them it all becomes clear...
Come on, what's not to love in such a code (part of an embedded webserver where saving memory and efficient use of the 12.5MHz clock is important)
PHP Code:
if(pSocket->step==1) { maxBytes=sizeof(pSocket->outBuffer) - (pSocket->pData - pSocket->outBuffer) - pSocket->nDataLeft - 1; if(maxBytes>1000) { maxBytes=1000; } fileBytes=fat_read_file(pSocket->filePtr, (unsigned char*)(pSocket->outBuffer + pSocket->nDataLeft), maxBytes); if(fileBytes>0) { *(pSocket->outBuffer + pSocket->nDataLeft + fileBytes)='\0'; pSocket->step = pSocket->step - 1; //to stay at the same step if more data exists } else { fileBytes=0; //avoid issues when returned an error case fat_close_file(pSocket->filePtr); *pSocket->pData = '\0'; //null terminate output data pSocket->pageReady = 1; } newBytes = fileBytes; }
Similar Threads
-
By jfreeman in forum Microsoft Office
Replies: 3
Last Post: September 30th, 2008, 01:24 PM
-
By geeksRus in forum Tech Lounge & Tales
Replies: 15
Last Post: October 16th, 2004, 10:34 AM
-
By Gazzza in forum Networking
Replies: 1
Last Post: March 26th, 2002, 07:22 AM
-
By JungleMan1 in forum Tech-To-Tech
Replies: 15
Last Post: July 22nd, 2001, 02:05 PM
-
By Quiet Thunder in forum Programming And Web Design
Replies: 7
Last Post: June 6th, 2001, 10:32 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks