How can I open a .txt file using execl() function? Is there any other function in c to open a file in gedit in Ubuntu.
Regards
Is there any other function in c to open a file in gedit
Th easiest would be
system("gedit file.txt");
As a side-note you might want to look into xdg-open.
You can try this also
execlp("/usr/bin/gedit","gedit","text.txt",NULL);
general syntax of execl() and execlp()
int execl(const char *path, const char *arg, ...);
int execlp(const char *file, const char *arg, ...);
give full path of text.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With