hi ı am triying to take the data of files in a folder with system function this is the code
char path[100],command[120];
scanf("%s",&path);
sprintf(command,"echo $(ls %s) > something.txt",path);
system(command);
but when I look to the something.txt there is no new line. This is the output, all on one line with many file names omitted:
acpi adjtime adobe apparmor.d arch-release asound.conf ati at-spi2 avahi bash.bash_logout ... wpa_supplicant X11 xdg xinetd.d xml yaourtrc
I did try -e
-E
-n
options of echo but it didn't work. How to make a new line after each of these files?