serXread() function not working

I am using a RCM3365 module (Dynamic C 9.25) to communicate with a PC (Visual Basic 6). When I send a string from the PC and read it with the serEread function, it appends all sorts of rubbish to my variable

For example when I send a password from the PC (“admin”) and read it with the serEread() function I recieve “admin2����~y��~�k2�u�v8{���”

This is part of my code where I read the string into the var Passw :


char Passw[10];
int n;

if((n=serEread(&Passw,5,20))>0)
{
      printf("%s
",Passw);
}



Am I missing anything with the function? I read the function reference and it looks straight forward there, but I can’t get it to work…

I got the same thing some time before. Still cant figure out the exact error.
But there is one thing that we have to remember, the %s prints all the characters until a ‘\0’ (null terminator) is found. I think this is the problem.

If you are sending in data without a null term at the end, it might be the problem.

Dont be so sure about it though, I’m also not an expert on this. Still getting my own hang around the Rabbit. :slight_smile:

It works with the null terminator (ascii 0)…thanks a heap!!