Reflection/Get source: Difference between revisions

no edit summary
(Added Kotlin)
No edit summary
Line 218:
The name of the source file (program) is: c:\reflecti.rex
The number of lines in the source program: 12
</pre>
 
=={{header|Ring}}==
<lang ring>
# Project : Reflection/Get source
# Date : 2018/05/18
# Author : Gal Zsolt [~ CalmoSoft ~]
# Email : <calmosoft@gmail.com>
 
fp = fopen("C:\Ring\applications\fifteenpuzzle\CalmoSoftFifteenPuzzleGame.ring","r")
r = ""
str = ""
flag = 0
numline = 0
give funct
funct = "func " + funct
while isstring(r)
r = fgetc(fp)
if r = char(10)
flag = 1
numline = numline + 1
else
flag = 0
str = str + r
ok
if flag = 1
//see left(str,len(funct)) + nl
if left(str,len(funct)) = funct
see '"' + funct + '"' +" is in the line: " + numline + nl
ok
str = ""
ok
end
fclose(fp)
</lang>
Output:
<pre>
give the function: rotateleft
"func rotateleft" is in the line: 328
</pre>
 
2,468

edits