I'm sorry, but I have no idea what it is that you want to do. You want the "absolute path" of what? The line of code you posted doesn't give me any clues either. Is it that you want to know what to set "sdcard" to?
Or are you saying you and the absolute path to ans.txt? If so, how is any code supposed to know that automatically since that file is one that you designate?
Perhaps if you posted the code you would like to write, rather than existing code...