Home > Archive > Fortran > July 2006 > About the instruction WRITE
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
About the instruction WRITE
|
|
| Aleramo 2006-07-23, 3:59 am |
| I am studing the Fortran 90/95 and i don't understand cos i see the
control character of the buffer when i write something. For example:
PROGRAM esempio41
! Esercizio 4.1, confronto tra la mia soluzione e quella del libro,
! ha ragione lui.
IMPLICIT NONE
WRITE (*,100)
100 FORMAT ("1", T25, "Questa =E8 una prova!")
END PROGRAM
It gives me:
1 Questa =E8 una prova!
but i mustn't see the character "1" right? it's a control character.
Does it allow me to go to a new page only with printers?
My second question is: why when i write i string i have a space at the
ends? i mean:
WRITE (*,*) "Hallo"
give me:
Hallo
Can i delete the two spaces at the beging and end of the string?
Bye Aleramo.
| |
| David Frank 2006-07-23, 7:59 am |
| > but i mustn't see the character "1" right? it's a control character.
> Does it allow me to go to a new page only with printers?
yes
> My second question is: why when i write i string i have a space at the
> ends? i mean:
> WRITE (*,*) "Hallo"
> give me:
> Hallo
> Can i delete the two spaces at the beging and end of the string?
> Bye Aleramo.
output a test char like below which will show you there is no
space written at the end using list output
write (*,*) "Hallo","|"
write (*,'(a)') "Hallo"
has no spaces in its output
| |
| Aleramo 2006-07-23, 7:59 am |
| Your answer is very useful for me, so i have to ask u, if u know on
Internet a Manual about Fortran 90 complete, i think mine is poor (i
use a book).
Bye bye Marco.
| |
| Tim Prince 2006-07-23, 7:59 am |
| Aleramo wrote:
> I am studing the Fortran 90/95 and i don't understand cos i see the
> control character of the buffer when i write something. For example:
> PROGRAM esempio41
>
> ! Esercizio 4.1, confronto tra la mia soluzione e quella del libro,
> ! ha ragione lui.
>
> IMPLICIT NONE
>
> WRITE (*,100)
> 100 FORMAT ("1", T25, "Questa è una prova!")
>
> END PROGRAM
>
> It gives me:
>
> 1 Questa è una prova!
>
> but i mustn't see the character "1" right? it's a control character.
> Does it allow me to go to a new page only with printers?
Treatment of 1st column as printer control has fallen into disuse. The
traditional filter programs fpr and asa could still be used to translate
such files.
| |
| e p chandler 2006-07-23, 6:59 pm |
| Aleramo wrote:
[snip question on carriage control]
> My second question is: why when i write i string i have a space at the
> ends? i mean:
>
> WRITE (*,*) "Hallo"
>
> give me:
>
> Hallo
>
> Can i delete the two spaces at the beging and end of the string?
>
You are using list directed formatting - specified by the second * in
the (*,*). This is supposed to output one leading space. Other than
that it may do a variety of things. Trailing spaces would be unusual
but as I understand it they would be allowed.
If you are outputting a character variable instead of a string literal,
you can use trim(var_name) to make sure trailing spaces are suppressed.
In order to have complete control over formatting you have to use an
explicit format specifier.
Also before R.M. chimes in, list directed formtting *is* formatted.
There may be no format statement label or string literal or character
variable containing a format specifier, but it still is formatted.
Formatted really means text.
-- elliot
|
|
|
|
|