# Comando write read

**URL:** <https://fortran-lang.discourse.group/t/comando-write-read/5355>\
**Category:** Help\
**Created:** [March 7, 2023, 5:13pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355 "2023-03-07T17:13:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 7, 2023, 5:13pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/1 "2023-03-07T17:13:49Z")

</div>

Uso fortram no windows.  
Quando dou read ou write nada acontece.  
A tela pisca e volta ao editorbForce 2.0

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [March 7, 2023, 6:32pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/2 "2023-03-07T18:32:13Z")

</div>

@Octavio , welcome to the forum.

Unfortunately, my understanding of Portuguese is very limited and I guess this holds for most users of this forum. Could you translate your question into English?

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 7, 2023, 7:18pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/3 "2023-03-07T19:18:29Z")

</div>

I use fortran in windows.  
When I read or write nothing happens.  
The screen blinks and goes back to editor bForce 2.0  
([deepl.com](http://deepl.com))

I guess @Octavio needs to give more details, source snippet …  
Acho que @Octavio precisa de dar mais detalhes, trecho da fonte …

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [March 7, 2023, 7:43pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/4 "2023-03-07T19:43:40Z")

</div>

I guess the “b” in editorbForce 2.0 is a typo. I have found this:

> **[Force Fortran - The Force Project](https://force.lepsch.com/)**
>
> Force is a free IDE for the FORTRAN 77/90 programing language.

[![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/e/ea1e5ae4945571f9e6dc723aa3b41d05463646fe.jpeg "fortran tutorial force 2.0") ](https://www.youtube.com/watch?v=WtBaQ0iHFi8)

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [March 8, 2023, 1:13pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/5 "2023-03-08T13:13:22Z")

</div>

If you are working with a good old Fortran program, the output goes to the console (or line printer, but few of us use those). If the program finishes running in, say, less than a second, and you are running from an IDE such as Force, the output window will be opened and closed in such a short period that you get the impression that “nothing happened”. Add a PAUSE statement at the end of your program, or move the main window of your IDE to the side so that you can see the output window.

Alternatively, build and run your program from the command line.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 7, 2023, 7:38pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/6 "2023-03-07T19:38:03Z")

</div>

I’ll try to use Google translator. Sorry to bother you I’m 75 years old and I was a great Fortran programmer in the 70’s when I was young. I did many programs at the university and professionally in companies. Today I decided to go back to “playing” with Fortran, even to avoid the boredom of old age. I installed Force 2.0, which I found interesting because it has the editor and the compiler together. My operating system is Windows 10. I made my first very simple program to start playing:

program testing  
implicit none  
real\*4 a,b,c  
a=23  
b=33  
c=a + b  
5 format (i3)  
print 5 c  
end

Ridiculous!

However, when I run it, it does not display the result on the screen, it just flashes the screen and returns to the editor. How do I display on the screen to see the result. Thanks

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [March 10, 2023, 6:39am UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/7 "2023-03-10T06:39:23Z")

</div>

Understood 🙂

I think the easiest way is indeed using the PAUSE statement, another method might be to read from the standard input:

```auto
write(*,*) 'Enter a number ...'
read(*,*) a

```

IDEs often show this kind of behaviour. It is annoying.

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [March 10, 2023, 8:57am UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/8 "2023-03-10T08:57:39Z")

</div>

> [@Octavio](#):
>
> it just flashes the screen

That’s how it appears, because we humans are not capable of processing a picture that is shown for a very short period, say, 0.01 seconds. To see this, add a DO I = 1, 1000 loop around the executable statements in your program, along with a declaration for the integer variable `I`, and run it again.

As suggested earlier, add a `PAUSE` or a `READ *,A` statement before the `end` statement.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 10, 2023, 8:30pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/9 "2023-03-10T20:30:10Z")

</div>

I changed the program a little so that it calculates the perimeter and area of a circle with radius r. Your Write (_,_) and Pause tips worked! The screen popped up with all the data! program testing

! Calcula o perimetro (P)e a rea (A) do circulo com raio r

implicit none  
real_4 r,P,A,pi  
write(_,_) ‘Entre com o raio …’  
read(_,_) r  
pi=3.14159  
P=2_pi_r  
A= pi_r\*\*2  
Write(_,_)P,A  
pause  
end

Thank you!!!

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [March 10, 2023, 9:19pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/10 "2023-03-10T21:19:46Z")

</div>

When you post code, please use the CODE button `</>` . If you do not do so, many characters, such as asterisks, will be removed or used to signify font face changes, etc., and your program will not work if a reader copies the code from the post and attempts to compile it.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 10, 2023, 9:58pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/11 "2023-03-10T21:58:36Z")

</div>

Please, send me a exemple.

---

<div class="post-metadata">

**Author:** ![egio](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@egio](https://fortran-lang.discourse.group/u/egio)\
**Post date:** [March 10, 2023, 11:38pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/12 "2023-03-10T23:38:06Z")

</div>

If you want

```fortran
program pluto
implicit none
real :: a, b, c
read(*,*) a, b
c = a * b
print *, c
end program

```

You can use backticks: three backticks like in the following picture.

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/2/261ddb3f55e3f500e73a35b8d1b0bc638c5d35eb.png)

They are not always present in not English keyboards but you can add them to your keyboard, on windows, using “Microsoft keyboard layout creator”. I definitely added the backticks ` and the tilde ~ to my keyboard.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 13, 2023, 5:52pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/13 "2023-03-13T17:52:21Z")

</div>

Like this

‘’'fortran  
program testando  
! Calcula o perimetro (P)e a rea (A) do circulo com raio r  
implicit none  
real_4 r,P,A,pi  
write(_,_) ‘Entre com o raio …’  
read(_,_) r  
pi=3.14159  
P=2_pi_r  
A= pi_r\*\*2  
Write(_,_)P,A  
pause  
end

‘’’

---

<div class="post-metadata">

**Author:** ![egio](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@egio](https://fortran-lang.discourse.group/u/egio)\
**Post date:** [March 13, 2023, 6:13pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/14 "2023-03-13T18:13:12Z")

</div>

No, sorry, it is the grave accent: 96 decimal entry in the ASCII table, 60 in hexadecimal.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 13, 2023, 6:59pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/15 "2023-03-13T18:59:24Z")

</div>

this ```

 ![teclado.jpg](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/7/7ea16358f8a368102855d0a733b4c44231d26c9c.jpeg)

---

<div class="post-metadata">

**Author:** ![egio](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@egio](https://fortran-lang.discourse.group/u/egio)\
**Post date:** [March 13, 2023, 7:54pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/16 "2023-03-13T19:54:12Z")

</div>

Yes!

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 13, 2023, 8:20pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/17 "2023-03-13T20:20:15Z")

</div>

Thank you!!!

---

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [March 13, 2023, 9:23pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/18 "2023-03-13T21:23:00Z")

</div>

@octavio The background for the three back ticks / accent grave to define a (fenced) code block is [markdown](https://en.wikipedia.org/wiki/Markdown), which is a markup language\* - to some degree similar to e.g., LaTeX, or html. However, it is one of the lighter ones and the lesson on [learnxinyminutes](https://learnxinyminutes.com/) possibly provides you with most of the functionality you might want to use most of the time. Arguably, the constrained syntax is _one_ reason why it can be engaged on so many platforms (including this discourse) like [r/fortran](https://www.reddit.com/r/fortran/), stackexchange/stackoverflow, issue reports on GitHub and GitLab, or is offered as (part of) editors/IDEs (e.g., [geany](https://plugins.geany.org/markdown.html)), and programs ([pandoc](https://pandoc.org/), [obsidian](https://obsidian.md/)).

\* Actually, there are a couple of markdown dialects (Gruber’s version, GitHub, pandoc) with small variations in functionality - however it _typically_ is not _this much_ important for a post in a forum.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 13, 2023, 9:38pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/19 "2023-03-13T21:38:08Z")

</div>

Thanks, I’ll check it out.

---

<div class="post-metadata">

**Author:** ![Octavio](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@Octavio](https://fortran-lang.discourse.group/u/Octavio)\
**Post date:** [March 14, 2023, 5:30pm UTC](https://fortran-lang.discourse.group/t/comando-write-read/5355/20 "2023-03-14T17:30:19Z")

</div>

Another big question that I looked for an answer on google. I want to run my EXE program (created by the Fortran compiler) on my cell phone’s Android. That is, transform EXE into APK. Google just gave me mixed answers. It’s possible? Thanks

[Next page](https://fortran-lang.discourse.group/t/comando-write-read/5355.md?page=2)
