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

  • Home
  • SEARCH
  • 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 7023029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:39:30+00:00 2026-05-27T23:39:30+00:00

Basically, my problem is a signed char to int and string conversion in cocoa.

  • 0

Basically, my problem is a signed char to int and string conversion in cocoa.

I found this piece of code in an open source cocoa bluetooth application and am trying to apply it to my own.

Basically, I get a signed char output from the variable “RSSI”, and want to convert it to an int and a string, the string for outputting to the log and the int for further calculation. However, no matter what I try, I cannot seem to get it converted, and just get an EXEC_BAD_ACCESS if I try outputting the signed char to the log as it is.

A typical value for the signed char would be ” -57 ‘\307’ ” quoted directly from the process before it is held up by the NSLog. Here’s the code:

- (BOOL)isInRange {
    BluetoothHCIRSSIValue RSSI = 127; /* Valid Range: -127 to +20 */

    if (device) {
        if (![device isConnected]) {
            [device openConnection];
        }
        if ([device isConnected]) {
            RSSI = [device rawRSSI];
            [device closeConnection];
            NSLog(RSSI);
        }
    }
    return (RSSI >= -60 && RSSI <= 20);
}

Thanks in advance.

  • 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-05-27T23:39:30+00:00Added an answer on May 27, 2026 at 11:39 pm

    NSLog() takes an NSString format string as its first argument, and an (optional) variable length list of variables for the format specifiers in the format string after that:

    NSLog(@"RSSI: %c", RSSI);

    What you’ve got now (NSLog(RSSI);) is simply wrong. It should be giving you compiler warnings like these:

    warning: passing argument 1 of 'NSLog' makes pointer from integer without a cast
    warning: format not a string literal and no format arguments
    

    You should always pay attention to compiler warnings, not ignore them. Especially when your program crashes on the same line the warnings refer to, they should be a red flag to you that you’ve made a mistake.

    As an aside, I should mention that NSLog() works very much like printf(). The two major differences are that NSLog‘s format string should be an Objective-C string literal (@"string"), not a standard C char string ("string"), and that the format specifier for an object is %@. %@ is replaced by the string returned by calling the -description method on the object to be printed.

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

Sidebar

Related Questions

Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
The problem is basically this, in python's gobject and gtk bindings. Assume we have
This is basically a math problem, but very programing related: if I have 1
I have basically the same problem outlined in this question, however I am using
Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code,
My problem basically looks like this: module Foo class Bar def self.who self.class.to_s end
So basically my problem can be written in pseudo-code as follows: split the line
How would I escape space characters in a JSON string? Basically my problem is
Basically my problem is this: I have a CSV excel file with info on
So basically the problem is that I have segment of code that needs to

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.