0

Here's my code-

#include <cs50.h>

int main(void)
{
    string x = get_string("hello");
}

pretty simple, and I compile it with clang -lcs50 test.c -o hello no error generated, but when I run it with ./hello, I get this-

output

it seems that the prompt which was "hello" before, has been converted to special characters. How can I fix this?

2
  • Something seems amiss. Your compile command creates an executable named "hello", but the run command mentioned is "test". The screen shot is for "hello". Are you looking at the correct file? The prompt suggests this might be outside the cs50 IDE. Can you test the same code in the IDE? If this is being run on another machine, which version of cs50.h is installed?
    – juls
    Apr 19 at 19:42
  • @juls sorry, that was a typo, im executung the correct file, and this code works fine on the cs50 ide, just not on my computer Apr 20 at 3:01
0

This is being addressed on github here: https://github.com/cs50/libcs50/issues/240

2
  • haha, that's actually the issue I opened Apr 24 at 3:37
  • @Nightmare247 yes, I know, which is why I linked it. :)
    – curiouskiwi
    Apr 24 at 9:06
0

I finally made it work, I somehow had 2 versions of cs50.h and the wrong one was being included. To someone else having the same problem, try doing locate cs50.h and check if you have more than one of them

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .