user3936: 
TX code:
#include <SoftwareSerial.h>

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

SoftwareSerial   Xbee(10, 11);

void setup() {
  Serial.begin(9600);
  Xbee.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;
  while( i < length )
  { 
    Serial.print(buffer[i]-48); 
    Xbee.print(buffer[i]-48);  
    i++;
  }        
}

RX code:
const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;

  while( i < length )
  { 
    Serial.print(buffer[i]-48);
    i++;
  } 
}

NOTE : 
1- The Rx xbee is receiving data even if am not sending and even if the TX xbee is powered off
2- When i send data from the TX xbee id didn't get revived by the RX xbee 
I need to solve both problems.
*** What i need exactly is to send serial data from my pc to arduino and send it wireless through xbee and then receive to the other arduino connected to my circuit   

user1585: The reason that it is printing characters with no input is that the readBytesUntil function has a timeout. If no new characters are received for a certain amount of time, "Serail.setTimeout()" seconds, it will just continue with the code. the default timeout is 1 second.
The reason you are not receiving what you transmit (or at least a reason) is that the RX code does not read from an xbee, but reads from regular "serial".
I recommend you try something simple first to test the xbee's configuration, like having TX run this:
void loop(){
    xbee.println("Hello");
    delay(1000);
}

and RX run something to echo serial like this:
 void loop(){
     if(xbee.available()){
         Serial.print((char)xbee.read());
     }
}

And make sure you set up an xbee object an the receiving side first.

3936: <p><img src="https://i.stack.imgur.com/qIFWb.png" alt="enter image description here"><img src="https://i.stack.imgur.com/bZxmF.png" alt="enter image description here"></p>

<p>TX code:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

SoftwareSerial   Xbee(10, 11);

void setup() {
  Serial.begin(9600);
  Xbee.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;
  while( i &lt; length )
  { 
    Serial.print(buffer[i]-48); 
    Xbee.print(buffer[i]-48);  
    i++;
  }        
}
</code></pre>

<p>RX code:</p>

<pre><code>const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;

  while( i &lt; length )
  { 
    Serial.print(buffer[i]-48);
    i++;
  } 
}
</code></pre>

<p>NOTE : </p>

<p>1- The Rx xbee is receiving data even if am not sending and even if the TX xbee is powered off</p>

<p>2- When i send data from the TX xbee id didn't get revived by the RX xbee </p>

<p>I need to solve both problems.</p>

<p>*** What i need exactly is to send serial data from my pc to arduino and send it wireless through xbee and then receive to the other arduino connected to my circuit   </p>
 1585: <p>The reason that it is printing characters with no input is that the readBytesUntil function has a timeout. If no new characters are received for a certain amount of time, "Serail.setTimeout()" seconds, it will just continue with the code. the default timeout is 1 second.</p>

<p>The reason you are not receiving what you transmit (or at least a reason) is that the RX code does not read from an xbee, but reads from regular "serial".</p>

<p>I recommend you try something simple first to test the xbee's configuration, like having TX run this:</p>

<pre><code>void loop(){
    xbee.println("Hello");
    delay(1000);
}
</code></pre>

<p>and RX run something to echo serial like this:</p>

<pre><code> void loop(){
     if(xbee.available()){
         Serial.print((char)xbee.read());
     }
}
</code></pre>

<p>And make sure you set up an xbee object an the receiving side first.</p>
