What's newline in Pascal? 
Author Message
 What's newline in Pascal?

Hi guys,

what's \n in Pascal (I don't mean writeln) and how to put a '-character
into a string?

Thanks in advance,
Dennis Schramm
www.dennis-schramm.com



Fri, 25 Nov 2005 01:47:17 GMT  
 What's newline in Pascal?
I am putting this into const
     BR = #13#10;

and write it when I need it?



Quote:
> Hi guys,

> what's \n in Pascal (I don't mean writeln) and how to put a '-character
> into a string?

> Thanks in advance,
> Dennis Schramm
> www.dennis-schramm.com



Fri, 25 Nov 2005 03:24:17 GMT  
 What's newline in Pascal?

Quote:

> what's \n in Pascal (I don't mean writeln) and how to put a '-character
> into a string?

There is no platform dependant way, since it is Writeln's business.
(Pascal's IO is not slow interpretative as C)

If you do it, I advise you to use some constant (so that you can change
it on other systems) like

CONST LineSep= #10;
      TheString='hello'+LineSep+'World';
Begin
 Write(TheString);
end.

P.s. If you use Free Pascal 1.0.x, this constant is already predefined as
"LineEnding".



Fri, 25 Nov 2005 04:34:06 GMT  
 What's newline in Pascal?

Quote:

> what's \n in Pascal (I don't mean writeln) and how to put a
> '-character into a string?

Strictly speaking there is no \n in Pascal.  That is why writeln
interfaces with the underlying system and terminates a line.  Any
time you emit funny characters such as chr(10) and chr(13) you are
enforcing Ascii, which may or may not be correct, and may or may
not do things that writeln does, such as flushing buffers.  File
systems may not use any end-of-line character whatsoever.

You embed ' in a string by doubling it.

   CONST query = 'What''s your problem?';
...
   writeln(query);

(* which is equivalent to:

   write(query); writeln;
*)

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Fri, 25 Nov 2005 05:46:15 GMT  
 What's newline in Pascal?
Pascal != C.

Quote:

> Hi guys,

> what's \n in Pascal (I don't mean writeln) and how to put a '-character
> into a string?

> Thanks in advance,
> Dennis Schramm
> www.dennis-schramm.com

--
Warning: poster of this email may be under the influence of
sleep inducing documents !


Fri, 25 Nov 2005 11:25:46 GMT  
 What's newline in Pascal?

Quote:

>> what's \n in Pascal (I don't mean writeln) and how to put a '-character
>> into a string?

> There is no platform dependant way, since it is Writeln's business.

... platform INdependant way............


Fri, 25 Nov 2005 19:36:01 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Pascal Newline Character

2. 'C' to PASCAL translator

3. Pascal to 'C' FAQ

4. Looking for equivalent to 'friend'(C++) in object pascal

5. TmT Pascal Lite question 'Speed Bumps'

6. Playing CD's or MIDI's in pascal

7. 'Bitfields' in Pascal

8. Playing AVI's and WAV's Through Turbo Pascal

9. MW Object Pascal vs Delphi's Pascal

10. pascal 'real' data to vb 'double'

11. type field ''money''

12. IndexDefs.Add('Help','Please',[ixD2WorksGreat, ixD3Errors])

 

 
Powered by phpBB® Forum Software