| User-Defined Opcode Database |
|---|
Returns the file name in a given path
Download UDO FileReturns the file name (= everything after the last slash) in a given path
Snam FilNam Spath
Spath - full path name as string
Snam - name part
opcode FilNam, S, S
Spath xin
ipos strrindex Spath, "/"
Snam strsub Spath, ipos+1
xout Snam
endop
<CsoundSynthesizer>
<CsOptions>
-m0
</CsOptions>
<CsInstruments>
opcode FilNam, S, S
;returns the name of a file path
Spath xin
ipos strrindex Spath, "/"
Snam strsub Spath, ipos+1
xout Snam
endop
instr name
prints "Printing name:\n"
Snam FilNam "/my/dir/my/file.WAV"
puts Snam, 1
endin
</CsInstruments>
<CsScore>
i "name" 0 0
</CsScore>
</CsoundSynthesizer>
Printing name:
file.WAV
joachim heintz 2012
| Previous | Home | Next |
| FileToPvsBuf | FilSuf |