Solved

Digital Fortran 6.5 Question

Posted on 2002-05-07
7
285 Views
Last Modified: 2013-11-08
Hi All,

I'm trying to write the content of an 2-dimensional array (integers) to a comma seperated file. I have trouble to convert the numbers into a "string". I want to do things like this:

integer myarray(20,3)
! I fill the array here with data
open(10,'c:\tmp\file.dat',STATUS='REPLACE'
do n=1 to 20
  mystring=myarr(n,1)//','
  mystring=myarr(n,2)//','
  mystring=myarr(n,3)//','
  write (10,*) mystring
enddo
etc...

I do not really how to format the numbers and change them into a "string" so I can write them to the file the way I want.

Does anyone have any experience with this?

Thanks in advance.

Hing.
0
Comment
Question by:Hing
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:jonnin
ID: 6994605
write it to an internal file and read it back out. there may be a cleaner way, all i can think of...
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6994655
Would the following work?
 
write (10,*) myarr(n,1),",",myarr(n,2),",",myarr(n,3)

mlmcc
0
 

Author Comment

by:Hing
ID: 6995816
Thanks mlmcc,

I thought about that too, but the problem is that each line I've written to the file will wrap automatically, something I don't want to happen.

anyone other ideas?

Hing.
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 101

Expert Comment

by:mlmcc
ID: 6997721
What do you mean the line or file wraps?  

Generally wrapping is a function of the display not the file.  

It's been a long time since I did any FORTRAN but I thought the line I gave you would do something like

45,56,78
23,43,65

mlmcc
0
 

Expert Comment

by:jespernaur
ID: 7240058
    write(10,20)myarr(n,1),myarr(n,2),myarr(n,3)
20   format(1x,i5,",",i5,",",i5)

This is a completely simple application of the FORTRAN FORMAT capability - you really should look into what else can be done

Best regards
Jesper Naur
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7515090

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7548151
Question has been closed as per recommendation

JGould-EE Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Starting up a Project

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question