CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Reading data from textfile into macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2016, 09:28
Default Reading data from textfile into macro
  #1
Member
 
Join Date: Aug 2014
Location: Germany
Posts: 77
Rep Power: 11
harry123 is on a distinguished road
Hi,

I wish to read some parameters from a text file and use it to assign values in a starccm macro. The code looks something like this:

java.io.FileReader freader = new java.io.FileReader("pathToFile");
java.io.BufferedReader inputFile=new java.io.BufferedReader(freader);

//courseName=inputFile.readLine();

while ((line=inputFile.readLine())!= null) {
String[] arrayline = line.split("\\s+");
data[i] = Double.parseDouble(arrayline[1]);
}

inputFile.close();

R = data[0];
L = data[1];
r = data[2];
l = data[3];
angle = data[4];

I'm getting a error:unreported exception, java.io.FileNotFoundException; must be caught or declared to be thrown.

I'm not too familiar with java, but still have tried all possible suggestions given in java forums. I'm not sure if the issue is related to how java scripts work in StarCCM.

It would be great help if someone can help me out !
harry123 is offline   Reply With Quote

Old   December 1, 2016, 14:45
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
You are not telling Java what to do in case the file you specify doesn't exist.
https://examples.javacodegeeks.com/j...und-exception/
me3840 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 07:31
Reading data from node file in UDF avd28 Fluent UDF and Scheme Programming 2 August 24, 2015 16:49
Parallel fluent and slow data reading on more than 24 cores mahdi_izadi FLUENT 0 February 10, 2015 08:39
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52


All times are GMT -4. The time now is 19:24.