C function only works with string literal
I'm trying to use a C function created by someone else.
here's it's declaration:
Code:
static void MDString(char *);
The code works just fine if I call the function like this:
Code:
MDString ("someString");
but it won't work if I call it with a c string from the console:
Code:
char *input;
cout<< endl << "Enter a string to be hashed: ";
cin>>input;
MDString(input);
I had been working on this problem earlier today and I got it to work :) ... but then I tried to clean up the code a few hours later and it no longer works :(
It compiles but crashes as soon as I call the function
I can't remember What I did, only that I only changed the code you see above. What are String Literals terminated with? Are they terminated at all? I think the answer might have something to do with that.