@@ -71,6 +71,25 @@ void append_llstring (LL_StringNode *appended, LL_StringNode *source, u_int16_t
71
71
_src -> next_letter = appended ;
72
72
}
73
73
74
+ char * llstr2char (LL_StringNode * llstring ) {
75
+ size_t size_of_llstring = ll_strlen (llstring );
76
+ char * str = (char * ) malloc (sizeof (char ) * size_of_llstring );
77
+
78
+ u_int16_t cursor_char = 0 ;
79
+ LL_StringNode * cursor_ll = llstring ;
80
+ while (cursor_ll != NULL ) {
81
+ // Copying the cursor_ll to str[cursor_char]
82
+ str [cursor_char ] = cursor_ll -> character ;
83
+ // Going to next cursors
84
+ cursor_char ++ ;
85
+ cursor_ll = cursor_ll -> next_letter ;
86
+ }
87
+ // Adding EOL to end of the string
88
+ str [cursor_char ] = '\0' ;
89
+ return str ;
90
+ }
91
+
92
+
74
93
/* String Manipulation Functions */
75
94
LL_StringNode * ll_strcpy (LL_StringNode * destination , LL_StringNode * source ) {
76
95
LL_StringNode * _cursor_src = source ;
@@ -88,12 +107,9 @@ LL_StringNode *ll_strcpy (LL_StringNode* destination, LL_StringNode* source) {
88
107
_cursor_dest = _cursor_dest -> next_letter ;
89
108
_cursor_src = _cursor_src -> next_letter ;
90
109
}
91
-
92
-
93
110
return destination ;
94
111
}
95
112
96
- /* String Manipulation Functions */
97
113
LL_StringNode * ll_strncpy (LL_StringNode * destination , LL_StringNode * source , u_int16_t count ) {
98
114
LL_StringNode * _cursor_src = source ;
99
115
LL_StringNode * _cursor_dest = destination ;
0 commit comments