Score:0

No Such File or directory using I/O redirection

mx flag

I am using I/O redirection in Linux to take input from a file named input.txt and output the results to outpu.txt for a compiled c++ program. The command goes like this:

/home/gajeet/Documents/OpenSource/Test < input.txt > output.txt

but this gives me a warning and an error:

warning: An error occurred while redirecting file 'input.txt'

open: No such file or directory

Note: input.txt and output.txt are in the same directory hierarchy inside the folder OpenSource.

muru avatar
us flag
Are you currently inside that directory when running this command?
mx flag
No I am in my home directory
muru avatar
us flag
And is there an `input.txt` in your home directory?
mx flag
My input.txt directory is home/gajeet/Documents/OpenSource/input.txt
muru avatar
us flag
Then use that path for the redirection.
mx flag
Oh okay I get it
mx flag
Thanks a lot @muru
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.