Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:50:53+00:00 2026-06-14T00:50:53+00:00

I have serial data I want to compare a specific byte to the letter

  • 0

I have serial data I want to compare a specific byte to the letter “G”.

LPtype is a byte that was read from the serial port.

if (LPtype == "G")
{
    doThis();
}

I get the following error:

C++ forbids comparison between pointer and integer

What would be the proper way of comparing the incoming bye to the letter G? (or any other letter for that matter)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:50:54+00:00Added an answer on June 14, 2026 at 12:50 am
    LPtype == 'G'
    

    Singular quotes. But LP usually prefixes pointer types, in which case you should dereference it

    *LPtype == 'G'
    

    But if you’re sure LPtype is indeed a byte value, then

    LPtype == 'G' 
    

    should work. The thing is that "G" has type const char[2], and is not an integer type, whereas 'G' has type char and is integer type

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I previously have been reading NMEA data from a GPS via a serial port
I have simple serial port program that is supposed to read the serial port
i want to read serial port when there is some data present i mean
I have a code to send data to serial port. I just want to
I have a python-based program that reads serial data off an a port connected
Here is my scenario: I have some data coming into serial port. I want
I have to monitor a serial port and process its data. As a test
I have a stream of data coming in over the serial line from an
I have a requirement where i have to read data streams coming on serial
I have a file handle to a serial (COM) port. I need to read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.