Silverfrost Forums

Welcome to our forums

Reading a text file: detecting a semi colon

22 Jun 2012 8:18 #10390

I'm reading a text file-line by line, I assign values to certain variables.

I want to read a variable in a line after a colon i.e. (: ) Example- if the first line in text file is:

Number of node points:1000

So, 1000 should be assigned to a variable number_nodes but 1000 should be read after the colan(: )

Can anyone advide how to do this?

Thanks, Christy

22 Jun 2012 8:58 #10393

Try this example: character line256 ! contents of line read integer4 n ! start of bnumber integer4 value ! value retreived ! line = 'Number of node points:1000' ! n = index (line,':') + 1 read (line(n:),) value ! write (,) n, value end

Please login to reply.