Rename a file: Difference between revisions

Content added Content deleted
(objc)
Line 45: Line 45:
rename("/docs", "/mydocs")
rename("/docs", "/mydocs")
)</lang>
)</lang>
=={{header|AWK}}==
Awk allows to call operating system commands with the ''system()'' function. However, the awk script won't get its output, only the return code. But this task is simple enough for the trivial implementation to work:
$ awk 'BEGIN{system("mv input.txt output.txt"}'
$ awk 'BEGIN{system("mv docs mydocs")}'
$ awk 'BEGIN{system("mv /input.txt /output.txt")}'
$ awk 'BEGIN{system("mv docs mydocs")}'

=={{header|C}}==
=={{header|C}}==
{{works with|gcc|4.1.2 20061115 (prerelease) (SUSE Linux)}}
{{works with|gcc|4.1.2 20061115 (prerelease) (SUSE Linux)}}