回 帖 发 新 帖 刷新版面

主题:请问各位,关于txt数据输入问题

各位,我求解了非线性方程组得到了一系列的数据,是txt格式的,我需要做的是把数据中的两列赋给另外一个程序的两个未知数,然后运行另一个程序,应该怎么做呢?
能不能告诉我啊,小弟不胜感激,谢谢你们了!

回复列表 (共4个回复)

沙发

这个问题比较笼统,我也只能笼统的回答。
格式化读入,然后再赋给另一个程序。

板凳

这个读入并输出到另一个文件, 然后另一个程序去读这个新文件...
不过两个程序你都可以改的话你就可以把它们弄在一起了.

3 楼

可以用批处理的通道,具体怎么弄我先测试下。

4 楼

a.f90
program out
implicit none
integer :: iout(10),i

do i=1,10
 iout(i) = i
enddo

write(*,*) iout(2)

end program
!b.f90
program in
implicit none
integer :: i_in

read(*,*) i_in

write(*,*) 'this data is from another exe',i_in

stop
end program

D:\tongdao>ifort b.f90
Intel(R) Visual Fortran Compiler Professional for applications running on IA-32,
 Version 11.1    Build 20100203 Package ID: w_cprof_p_11.1.060
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

-out:b.exe
-subsystem:console
b.obj

D:\tongdao>ifort a.f90
Intel(R) Visual Fortran Compiler Professional for applications running on IA-32,
 Version 11.1    Build 20100203 Package ID: w_cprof_p_11.1.060
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

-out:a.exe
-subsystem:console
a.obj

D:\tongdao>a | b
 this data is from another exe           2

D:\tongdao>

我来回复

您尚未登录,请登录后再回复。点此登录或注册