Thread: Problem: far to near copy, and vice versa

  1. #1
    Registered User
    Join Date
    Apr 2004

    Problem: far to near copy, and vice versa

    Could someone tell me what is wrong with this?

    static byte	response_string[300];
    static byte far	far_response_string[3500];
    _fstrncpy( far_response_string, "hi", 3 );
    response_string[0] = far_response_string[1];
    sprintf( _temps, "%c", response_string[0] );
    puts_lcd( _temps );
    What i get on the lcd is nothing (null)

    I have a feeling that the
    response_string[0] = far_response_string[1];
    line is copying it as a null.

    I've tried casting the far_response_string[0] to a (byte) also but with the same problem, the scary thing is that the compiler doesn't complain. I would have expected a suspicious pointer conversion warning if it was a casting issue.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem: 64k block issue
    By aaronc in forum C Programming
    Replies: 1
    Last Post: 06-16-2004, 03:22 AM
  2. copy constructor/type converter?
    By kny in forum C++ Programming
    Replies: 2
    Last Post: 03-13-2002, 10:44 PM