Arduino RF VirtualWire.h

I want to send "11111111"by input this to the serial using this code:

#include <VirtualWire.h>
char buf1[8];
int i;

void setup() {
  Serial.begin(9600);
  vw_set_tx_pin(3);
  vw_set_rx_pin(2);  
  vw_setup(2000);
  vw_rx_start(); 
  
}

void loop() {
  while (Serial.available() > 0) {
    int x = Serial.parseInt();
    Serial.println(x);
    for(i=7;i>=0;i--){
      buf1[i]= x % 10;
          x /= 10;
        }
    
    vw_send((uint8_t *)buf1, strlen(buf1));
    
  }
  
 }

This code work for example “11111” but for not work for “11111111”.

Look up strlen.
A string is a NULL terminated array.

Edit:

not work for "11111111"

char buf1[8];

I change buf1[8] to buf1[9] and the same error.Who i solve this?

Hint:
11111 works
Integer -32768 to 32767

int x = Serial.parseInt();

I dont understand,can you explain?

11111 is in this range -32768 to 32767

111111 or 1111111 or 11111111 are not integers they are bigger than 32767

int x = Serial.parseInt(); // Returns an integer, your 11111111 is too big

I understand.Is any way to solve this?

vasr:
I understand.Is any way to solve this?

You're receiving it through Serial as a string, stuffing it into an int, and using the int to convert it to BCD. Why not just subtracted '0' from each character when you receive it and put it in the array. When you receive a non-number send the array.

Can you make a example?

vasr:
Can you make a example?

char a = Serial.read();
if (isDigit(a))
{
  b[i] = a - '0';
  i++;
}
else
{
  // send the data
}

Still not working, any ideia?

Still not working, any ideia?

Hey, I've got an idea. Why don't you POST SOME CODE?

While you're at it, feel free to volunteer just what the hell "Still not working" means!