lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm implementing C wrapper around pidof command.

pidof returns a string of pids for given process.
For example, pidof xterm -> 34 56 546

Currently my C impl. returns just a string '34 56 546' but I want it
to return a table {[1]=34,[2]=56,[3]=546,[n]=3}.

In lua i wrote
t = {}
s = pidof('rxvt')
gsub(s, '(%S+)', function (str) tinsert(%t, str) end)

How can rewrote it in C?

-- 
How much do Windows cost, and do you have to buy each one separately?