Stepping Through Lines In A Buffer

This is a discussion on Stepping Through Lines In A Buffer within the C Programming forums, part of the General Programming Boards category; Yes: Beginning If you have questions like this I suggest starting a new thread. You've about hijacked this one as ...

  1. #16
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    Yes: Beginning

    If you have questions like this I suggest starting a new thread. You've about hijacked this one as this isn't helping the OP.
    If you understand what you're doing, you're not learning anything.

  2. #17
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    Not. You're making the incorrect assumption that he's reading in one line at a time. Again...documentation. Directly from the RFC that the OP mentioned in the very first post of this thread:
    Responses to certain commands are multi-line. In these cases, which
    are clearly indicated below, after sending the first line of the
    response and a CRLF, any additional lines are sent, each terminated
    by a CRLF pair.
    If you understand what you're doing, you're not learning anything.

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    EOF cannot be stored in a char. Must you crap up every thread?


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #19
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    MDofRockyView: I'll be happy to fully document my code for you when it's finished.

    Can't work on it at the mo as I'm in work, but I got a few ideas from my sleep last night (as you do). Gonna turn this "jumping through lines" bit into a function that returns null-terminated lines from the buffer until it reaches the end.

    But essentially the size of the message as reported by the LIST command isn't being matched by my code as it goes through the lines and counts the bytes it has read.

    You might think it's a bit of a pointless act but the whole idea behind it is to flick through the buffer as the packets come in and extract header information. As there isn't any standard mechanism with which I can get the headers (If you're gonna reply with "TOP", don't bother, it's an optional command and isn't implemented on the server I'm talking to) and I don't want to store the entire message and then read through it I'm taking the streaming approach.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 08:27 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 09:09 PM
  3. Having Buffer Problems With Overlapped I/O --
    By Sargera in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 04:46 PM
  4. recv multiple lines
    By TCM in forum Networking/Device Communication
    Replies: 11
    Last Post: 07-13-2004, 05:54 PM
  5. count only lines of code...
    By flightsimdude in forum C Programming
    Replies: 13
    Last Post: 09-23-2003, 08:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21