Does your program accept any command-line parameters? If so, maybe you specified some in Project -> Set programs' arguments that make it behave differently.
Another way to check is to set Settings -> Compiler -> Other -> Compiler logging to "Full command line", then run your project. The log will show exactly what command line Code::Blocks runs (including any command-line parameters) and in which directory (relative to your project dir).
See if pasting that command line into a DOS prompt (with as current working directory the same directory as C::B used) produces the same result as running your program from Code::Blocks.
If you still can't figure it out after checking that, try posting your project (sources, .cbp file and sample input) or a link to it. Maybe that extra information would help people here figure out what's going wrong.