Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Errors with conversion of unsigned char [] to const char *

Errors with conversion of unsigned char [] to const char *

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Hihn
    wrote on last edited by
    #1

    I don't think I've ever had to cast calls to str{len|cpy| etc..} before. What's more is that it's an error: error C2664: 'strlen' : cannot convert parameter 1 from 'unsigned char [256]' to 'const char *' as used in: dwLen = strlen(modemInit[i]); They should be warnings - if anything is to be said at all. Is there someway for me to set it so I don't have to cast it?

    C M 2 Replies Last reply
    0
    • J Jason Hihn

      I don't think I've ever had to cast calls to str{len|cpy| etc..} before. What's more is that it's an error: error C2664: 'strlen' : cannot convert parameter 1 from 'unsigned char [256]' to 'const char *' as used in: dwLen = strlen(modemInit[i]); They should be warnings - if anything is to be said at all. Is there someway for me to set it so I don't have to cast it?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      try strlen(&modemInit[i]) ... ? -c


      Smaller Animals Software, Inc.

      1 Reply Last reply
      0
      • J Jason Hihn

        I don't think I've ever had to cast calls to str{len|cpy| etc..} before. What's more is that it's an error: error C2664: 'strlen' : cannot convert parameter 1 from 'unsigned char [256]' to 'const char *' as used in: dwLen = strlen(modemInit[i]); They should be warnings - if anything is to be said at all. Is there someway for me to set it so I don't have to cast it?

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        The char type is signed, so an unsigned char* doesn't match a signed char*. --Mike-- http://home.inreach.com/mdunn/ While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate. :love: your :bob: with :vegemite: and :beer: Sonork - 100.10414 AcidHelm

        Test out a prerelease build of my Hotfix Checker v2.0! (133K)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups