readLine and line terminators

Nick Sabalausky a at a.a
Wed Jun 18 13:57:14 PDT 2008


"llee" <llee at goucher.edu> wrote in message 
news:g3br0o$21np$1 at digitalmars.com...
> I'm parsing a cgi request and was using the din.readLine function to get 
> each line. readLine will read bytes from a stream until it encounters 
> either '\n' or '\r'. I need it return lines terminated with "\n\r". Does 
> anyone know how to do this. Or if there are any other options.

I'm not familiar with the details of the text IO APIs, but you could always 
just wrap it in another function like this:

//Psuedocode
string ReadLineGuaranteeLineEnding() // Could probably think of a better 
name
{
    // Read from din.readLine
    // Check for and remove any trailing '\n' and '\r'
    // Append "\n\r"
    // Return result
} 





More information about the Digitalmars-d mailing list