summaryrefslogtreecommitdiff
path: root/current_directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'current_directory.c')
-rw-r--r--current_directory.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/current_directory.c b/current_directory.c
new file mode 100644
index 0000000..a9eec1b
--- /dev/null
+++ b/current_directory.c
@@ -0,0 +1,37 @@
+/*
+ * =====================================================================================
+ *
+ * Filename: current_directory.c
+ *
+ *
+ * Version: 1.0
+ * Created: 02/10/2025 10:26:51 AM
+ * Revision: none
+ * Compiler: gcc
+ *
+ * Author: YOUR NAME (),
+ * Organization:
+ *
+ * =====================================================================================
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <linux/limits.h>
+
+int main()
+{
+ char cwd[PATH_MAX];
+ if (getcwd(cwd, sizeof(cwd)) != NULL)
+ printf("%s", cwd);
+ else {
+ perror("getcwd() error");
+ return 1;
+ }
+ return 0;
+}
+
+
+
+
+