i am having trouble with testing to see if aData is equal to
exit i have tried a few diffrent things the only thing i
have relized is that the compiler say that aData is a multi character constant any help is greatly appreciated

while (exit != 1)
      {

    char aData = aPort.read ();

cout << aData;

if(aData == 'EXIT')
{
exit = 1;
}
            }

A character is a single character and not a string. 'a' is a character. 'Exit' is 4 characters 'E', 'x', 'i', 't'.

I guess you can do 3 things.

a) Compare 2 character arrays
b) Use a string
c) Use a single letter like, press 'E' to exit.

1) you can not compare a single character such as aData with a string such as "Exit".

2) 'Exit' must be surrounded with double quotes, such as "Exit".

i see what you guys mean but then how would i be able to make a bunch of char's into one var im new to c++ but if you can steer me in the right direction i greatly appreciate it

this is code im working on for a barcode scanner and i am using a class for the serial communications but when i get the data from there it prints fine but it populates it char by char how would i make that into one var ?

If you want to make it really easy then just replace char aData with string aData and you'll be done. If you need to use a char array then you need to use a function like strcmp(charArray1, charArray2). There's a nice little reference on the function...

http://www.cplusplus.com/reference/clibrary/cstring/strcmp/

Look at the examples on that page. They're very simple and match exactly what you are doing. If you follow the example then you'll be done.

good answer but as i was making it i relized it was better char by char because it was easier to get rid of certain chars and reformat it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.