Hello and thank you! I'm a bit new so bear with me.
I'm attempting to conduct serial communication between my computer and an Arduino.
I'm using the CreateFile(...) function to attempt to do this.
Coming from the world of java, I just get a bad itch when something that should be an instance variable isn't.
My problem is that one of the variables, the file name, is of type LPCSTR, which, as I understand it is a long pointer (16bit) constant character.
It is equivalent to: const char*
Now I have two questions: Here is part of my code for reference:
portName = str;
The first issue is that I cannot assign a string to a constant character. I cannot assign a string to a character PERIOD. That is obvious, but then how am I suppose to put the value of lets say "COM3" in there?
Secondly, even if the conversion did work, the value is declared constant. So I anticipate that as the second error. I cannot give this constant a value after I initialize it.
I'm using the createFile(...) function as per this link:http://www.codeproject.com/Articles/3061/Creating-a-Serial-communication-on-Win32#creating
EDIT: When I do this:
portName = "COM3";
It works. Why can string literals go into things of type char??