title: Reading from an external file in node.js
body: <p>I've just started using node.js, and I have been looking for ways to count the number of lines in a cpp file stored on my machine (in a different directory from that of the node.js app).</p>
  
  <p>I am trying just read text from a cpp file stored inside the node.js project for now, with this function: 
   <code>console.log(fs.readFileSync('code.cpp', 'utf8'));</code> </p>
  
  <p>but I get this error: </p>
  
  <blockquote>
    <p>fs.js:646     return binding.open(pathModule._makeLong(path),</p>
    
    <p>stringToFlags(flags), mode);
                     ^</p>
    
    <p>Error: ENOENT: no such file or directory, open
    'C:\Users\Heba\WebstormProjects\wrfile\sever.cpp'
        at Object.fs.openSync (fs.js:646:18)
        at Object.fs.readFileSync (fs.js:551:33)
        at Object. (C:\Users\Heba\WebstormProjects\wrfile\app.js:5:16)
        at Module._compile (module.js:643:30)
        at Object.Module._extensions..js (module.js:654:10)
        at Module.load (module.js:556:32)
        at tryModuleLoad (module.js:499:12)
        at Function.Module._load (module.js:491:3)
        at Module.require (module.js:587:17)
        at require (internal/module.js:11:18)</p>
    
    <p>Process finished with exit code 1</p>
  </blockquote>
  
  <p>Is this the right approach to the problem? if so how can I fix this error?</p>
  
  <p>Thanks in advance. </p>