linux find where file is mounted

C++
df -Ph $filename
Source

Also in C++: