Outputting Bitmap Images in Fortran without Record Delimiters

In summary: With "implicit none", the compiler will stop with an error message, forcing you to correct the misspelled variable name.
  • #1
drp85
1
0
In Fortran I need to output some data as a bitmap image, to visualise results. Problem is, with every WRITE statement it seems to append some unwanted bytes before and after the data itself. I have found out that these are called record delimiters, but I want to turn these off. How?
 
Technology news on Phys.org
  • #2
I have played with f95, and when I ran into trouble I used to post on a site http://www.tek-tips.com
Try there to see if you get any answers.
 
  • #3
Hi Friends,
Im trying to compile a small fortran code, but it gives me the following error.
g77 -o rayinv_vel_modl rayinv_vel_modl.f
dimension.inc: In subroutine `outputv':
dimension.inc:5:
integer mnsg, mnsg1, mnsgf
1
dimension.inc:17: (continued):
& mnsgf=nomi*mnsg, mnsd1=mnsd+mnsgf)
2
Invalid declaration of or reference to symbol `mnsgf' at (2) [initially seen at (1)]
dimension.inc:17:
& mnsgf=nomi*mnsg, mnsd1=mnsd+mnsgf)
^
Invalid form for PARAMETER statement at (^)Can someone help me, what's wrong with the code?

Thanking you in anticipation

cheers
 
  • #4
Hi friends;
I have some problems with my fortran programma.When I compile it, the above errors occur;
dms0.f: In subroutine `ftltow':
dms0.f:123: warning:
call ftltow(gl,gw,S,dtau,0,nmax)
1
dms0.f:828: (continued):
subroutine ftltow(gl,gw,maxl,dtau,bose,nmax)
2
Argument #2 (named `gw') of `ftltow' is one precision at (2) but is some other precision at (1) [info -f g77 M GLOBALS]
dms0.f:123: warning:
call ftltow(gl,gw,S,dtau,0,nmax)
1
dms0.f:828: (continued):
subroutine ftltow(gl,gw,maxl,dtau,bose,nmax)
2
Argument #3 (named `maxl') of `ftltow' is one type at (2) but is some other type at (1) [info -f g77 M GLOBALS]

What is reason of these errors?

Thanks
 
  • #5
They are not errors, they are warnings...it says it right there.

Also it say they are in regards to precision. That means that you have one variables declared with, say, REAL*4 but then you pass it to a function or subroutine and the variable catching this quantity is declared inside the subroutine with, say, REAL*8

...something along those line

Hope it helps.
 
  • #6
selmayda said:
Hi;

Again I have a problem.what is the meaning of above warning?
thanks for helps

dms0.f: In subroutine `ftltow':
dms0.f:123: warning:
call ftltow(gl,gw,S,dtau,0,nmax)
1
dms0.f:828: (continued):
subroutine ftltow(gl,gw,maxl,dtau,bose,nmax)
2
Argument #3 (named `maxl') of `ftltow' is one type at (2) but is some other type at (1) [info -f g77 M GLOBALS]

Your variable "S" is defined as a different type (or kind) than that of your variable "maxl". It may be that one or other of these has been left undefined and is using an implicit type.

BTW. If you're not already doing so, I strongly recommend that you add the line "implicit none" to all of your programs and subroutines.
 
  • #7
Thanks for your help
 
  • #8
uart said:
I strongly recommend that you add the line "implicit none" to all of your programs and subroutines.

I second that recommendation. Besides situations like this one, it will prevent problems caused by simply misspelling a variable name. Without "implicit none", this creates a new variable of some default type, without your knowing it.
 

Related to Outputting Bitmap Images in Fortran without Record Delimiters

1. How can I output a bitmap image in Fortran without record delimiters?

To output a bitmap image in Fortran without record delimiters, you can use the WRITE statement with the ACCESS='DIRECT' option. This will allow you to write data to a file without any record delimiters.

2. Can I use the PRINT statement to output a bitmap image?

No, the PRINT statement is used to print text to the screen or to a file. To output a bitmap image, you need to use the WRITE statement with the ACCESS='DIRECT' option.

3. What format should the bitmap image be in for Fortran?

Fortran can output bitmap images in a variety of formats, including BMP, PNG, and JPEG. However, the exact format may depend on the compiler and operating system you are using. It is best to consult the documentation for your specific Fortran compiler to determine the appropriate format.

4. How do I specify the size and resolution of the bitmap image in Fortran?

The size and resolution of the bitmap image can be specified by using the FORM='UNFORMATTED' option in the WRITE statement, followed by the REC= and UNIT= options to specify the size and resolution, respectively. Alternatively, you can use the RESHAPE statement to resize the image before outputting it.

5. What is the difference between a bitmap image and a vector image?

A bitmap image is made up of pixels, or small colored squares, while a vector image is made up of mathematical equations that describe the shapes and lines in the image. Bitmap images are often used for photographs and complex images, while vector images are better for simple images and logos, as they can be resized without losing quality.

Similar threads

  • Programming and Computer Science
Replies
19
Views
3K
  • Programming and Computer Science
Replies
29
Views
5K
  • Programming and Computer Science
Replies
4
Views
662
  • Programming and Computer Science
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
Replies
10
Views
976
Back
Top