tieuthienthan
Active member
I'm new to writing cleo and I'm trying to make a cleo which reads file name from .ini file.
My dev.ini file:
If I use
Please help me, I really need this to make my cleo work properly.
Thanks.
Code:
{$CLEO .cs}
0000:
10@ = 0
while true
wait 0
if and
0AB0: key_pressed 18 // alt
0AB0: key_pressed 37 // left arrow
10@ == 0
then
10@ = 1
wait 500
end
if
10@ == 1
then
10@ = 2
wait 500
0AC8: 11@ = allocate_memory_size 1024
0AF4: 11@ = read_string_from_ini_file "cleo\dev.ini" section "CONFIG" key "RECORD" // a string value as file name
0AB1: call @xianzai 1 filename "%s" 11@ store_to 10@ // open file in section "config" key "record"
end
end
:xianzai
0AC8: 30@ = allocate_memory_size 1024
05AA: 30@ = 0@ // get the first parameter
if
0AAB: file_exists "%s" 30@
then
0B00: delete_file "%s" 30@
0AD1: "~g~file found! %s" time 1337 30@
else
0AD1: "~g~file not found! %s" time 1337 30@
end
0A9A: 28@ = openfile "%s" mode "wb+" 30@
while true
wait 0
{to-do things with file}
break
end
0A9B: closefile 28@
0AB2: return 1 0
Code:
[CONFIG]
RECORD=cleo\2.dev
0A9A: 28@ = openfile "cleo\2.dev" mode "wb+"
and without any parameters it works perfectly but when I try to read a string from file and then use that to open file, it doens't work and just gives some opcode's error warnings.Please help me, I really need this to make my cleo work properly.
Thanks.