Check ur application separately by compiling it as alone application and by passing the file name called node 1 in current directly and check what it returns if it works properly then the problem which r u facing is not in the application it's somewhere in ur device write program.