I have a character arraym char Input[200];
input as of now has the string "abc.txt".
I have a method that strictly needs a const char *, how can I convert my input array into a const char *.
I tried casting it, and passing it, but upon using GDB, I feel like since the remaining 192 slots in input are filled with garbage(or are empty)its not being accepted by the function. When I pass the string literal "a.txt" to the function it works. so at this point I would like to extract the filled up elements from input array and convert it to a const char *.
I am taking input as a filename from a user, so I used a char array to store the input.
int main()
{
char *name;
char input[1024];
strcpy(input, argv[1]);
name = input;
sys_open(input, "O_RDWR", 00700);
}
open
(or for that mattersys_open
(which you should not call directly)) is not a string.