Fix not reading file correctly
This commit is contained in:
parent
cfcd98a239
commit
666aab275c
@ -1,5 +1,5 @@
|
||||
program main
|
||||
use WebServer, only: get_progress
|
||||
!use WebServer, only: get_progress
|
||||
use FileReader, only: read_file
|
||||
use Greeter, only: say_hello
|
||||
|
||||
@ -8,6 +8,6 @@ program main
|
||||
character, allocatable :: Data
|
||||
|
||||
call say_hello()
|
||||
call get_progress()
|
||||
!call get_progress()
|
||||
call read_file("/home/skingging/Documents/Projects/Fortran/Web-Server-In-Fortran/html/index.html", Data)
|
||||
end program main
|
||||
|
@ -1,5 +1,5 @@
|
||||
module FileReader
|
||||
!implicit none
|
||||
implicit none
|
||||
|
||||
public :: read_file
|
||||
contains
|
||||
@ -26,10 +26,8 @@ module FileReader
|
||||
|
||||
allocate(character(len=0) :: TempData) ! Start with an empty string
|
||||
|
||||
read(io, *, iostat=iostat)
|
||||
|
||||
do
|
||||
read(io, *, IOSTAT=iostat) LineBuffer
|
||||
read(io, '(A)', IOSTAT=iostat) LineBuffer
|
||||
if (iostat /= 0) exit ! Exit loop on end-of-file or error
|
||||
|
||||
! Append the current line to TempData. CHAR(10) is a newline
|
||||
|
@ -7,6 +7,11 @@ module WebServer
|
||||
|
||||
public :: get_progress
|
||||
contains
|
||||
|
||||
|
||||
! https://github.com/modern-fortran/tcp-client-server/blob/master/server.f90
|
||||
|
||||
|
||||
subroutine get_progress
|
||||
! Send a GET request to retrieve JSON data
|
||||
response = request(url='https://proxy.rbwr.dk/progress')
|
||||
|
Loading…
Reference in New Issue
Block a user