char to constant char*

I have a setup that has an arduino and accelerometer and a transmitter sending the acceleration to another arduino that has a receiver and a sd card to store the date. I am unable to get the data in the right format.

Transmitter

/*Arduino --------------- MMA8452Q Breakout
 5V  ---------------     3.3V (used a level shifter)
 GND   ---------------     GND
 SDA (A4) --\/330 Ohm\/--    SDA
 SCL (A5) --\/330 Ohm\/--    
 
 pin 9 ------------- tx pin
 vin -------- tranmiter v+
 */
#include <VirtualWire.h>
#include <Wire.h>
#include <SFE_MMA8452Q.h>

#undef int
#undef abs
#undef double
#undef float
#undef round

MMA8452Q accel;

void setup()
{
  Serial.begin(2400);
  accel.init();
  // or accel.init(SCALE_4G); gives +/- 4g
  //or accel.init(SCALE_8G); give +/- 8g
  //ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12,
  //     ODR_6, or ODR_1. 
  //Sets to 800, 400, 200, 100, 50, 12.5, 6.25, or 1.56 Hz output
  // //accel.init(SCALE_8G, ODR_6);
  vw_set_ptt_inverted(true);// Required for RF Link module
  vw_setup(2000);      // Bits per sec
  vw_set_tx_pin(9);
}
void loop()
{

  // accelerometer code
  // Use the accel.available() function to wait for new data
  //  from the accelerometer.
  if (accel.available())
  {
    // First, use accel.read() to read the new variables:
    accel.read();

    // accel.read() will update two sets of variables. 
    // * int's x, y, and z will store the signed 12-bit values 
    //   read out of the accelerometer.
    // * floats cx, cy, and cz will store the calculated 
    //   acceleration from those 12-bit values. These variables 
    //   are in units of g's.
    // Check the two function declarations below for an example
    // of how to use these variables.
    printCalculatedAccels();
    //printAccels(); // Uncomment to print digital readings

      // The library also supports the portrait/landscape detection
    //  of the MMA8452Q. Check out this function declaration for
    //  an example of how to use that.
    printOrientation();
    char x = convert(accel.x); //converts int to string
    char y = convert(accel.y);
    char z = convert(accel.z);
    Serial.println(); // Print new line every time.
    // tranmitter code
    const char *msg = ("x:/n", x, "y:/n", y, "z:/n", z);
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
  }
}
// The function demonstrates how to use the accel.x, accel.y and
//  accel.z variables.
// Before using these variables you must call the accel.read()
//  function!
void printAccels()
{
  Serial.print(accel.x, 3);
  Serial.print("\t");
  Serial.print(accel.y, 3);
  Serial.print("\t");
  Serial.print(accel.z, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.cx, accel.cy,
//  and accel.cz variables.
// Before using these variables you must call the accel.read()
//  function!
void printCalculatedAccels()
{ 
  Serial.print(accel.cx, 3);
  Serial.print("\t");
  Serial.print(accel.cy, 3);
  Serial.print("\t");
  Serial.print(accel.cz, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.readPL()
// function, which reads the portrait/landscape status of the
// sensor.
void printOrientation()
{
  // accel.readPL() will return a byte containing information
  // about the orientation of the sensor. It will be either
  // PORTRAIT_U, PORTRAIT_D, LANDSCAPE_R, LANDSCAPE_L, or
  // LOCKOUT.
  byte pl = accel.readPL();
  switch (pl)
  {
  case PORTRAIT_U:
    Serial.print("Portrait Up");
    break;
  case PORTRAIT_D:
    Serial.print("Portrait Down");
    break;
  case LANDSCAPE_R:
    Serial.print("Landscape Right");
    break;
  case LANDSCAPE_L:
    Serial.print("Landscape Left");
    break;
  case LOCKOUT:
    Serial.print("Flat");
    break;
  }
}

char convert(int n)
{
  int Number = n;       // number to be converted to a string

 
  String string = String(Number);
  string.toCharArray(Result[],string.length());
  return Result;
}

Receiver

#include <SD.h>
#include <VirtualWire.h>

const int chipSelect = 4;

void setup()
{
  Serial.begin(2400);

  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);      // Bits per sec
  vw_rx_start();      // Start the receiver PLL running
  vw_set_rx_pin(8);  //set receiver pin to 8

    Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
  // make a string for assembling the data to log:
  String dataString = "";

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int i;
    digitalWrite(9, true); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");

    for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);
      Serial.print(" ");
      dataString += ((char)buf[i]);
    }
    Serial.println("");
    digitalWrite(9, false);
  }
  File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

Right now I am getting an invalid conversion form char to constant char* but am lost on how to fix it. Thanks for the help!

A 'char' is a single character of 8 bits.
A 'String' is a class.

Using readable data is (almost) never used with Virtual Wire. Only binary data, like integers or float numbers.
When you want to transmit data, you could use a buffer with binary data, or use a struct.

3 integers (16-bit integers), that is 6 bytes to transmit.

// using a buffer.
char myXYZ[6];

myXYZ[0] = lowByte( accel.x);
myXYZ[1] = highByte( accel.x);
...
// transmit the myXYZ[] array.

http://arduino.cc/en/Reference/LowByte
http://arduino.cc/en/Reference/HighByte

Or use a structure.

struct {
  int x;
  int y;
  int z;
} myValues;

myValues.x = accel.x;
myValues.y = accel.y;
myValues.z = accel.z;

// transmit the struct, use a pointer to it and use 'sizeof' for the length.

Which library are you using ?
This one ? http://github.com/sparkfun/MMA8452_Accelerometer/tree/master/Firmware/libraries/SFE_MMA8452Q

What is this ?

#undef int
#undef abs
#undef double
#undef float
#undef round

Can you remove that ?

This is only needed for some special modules, you probably don't need this line:

vw_set_ptt_inverted(true);

Which library are you using ?
This one ? http://github.com/sparkfun/MMA8452_Accelerometer/tree/master/Firmware/libraries/SFE_MMA8452Q

Yes I am

I am still very confused and have no idea what a structure was but tried to implement it any ways

/*Arduino --------------- MMA8452Q Breakout
 5V  ---------------     3.3V (used a level shifter)
 GND   ---------------     GND
 SDA (A4) --\/330 Ohm\/--    SDA
 SCL (A5) --\/330 Ohm\/--    
 
 pin 9 ------------- tx pin
 vin -------- tranmiter v+
 */
#include <VirtualWire.h>
#include <Wire.h>
#include <SFE_MMA8452Q.h>


MMA8452Q accel;

void setup()
{
  Serial.begin(2400);
  accel.init();
  // or accel.init(SCALE_4G); gives +/- 4g
  //or accel.init(SCALE_8G); give +/- 8g
  //ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12,
  //     ODR_6, or ODR_1. 
  //Sets to 800, 400, 200, 100, 50, 12.5, 6.25, or 1.56 Hz output
  // //accel.init(SCALE_8G, ODR_6);
  vw_setup(2000);      // Bits per sec
  vw_set_tx_pin(9);
}
void loop()
{

  // accelerometer code
  // Use the accel.available() function to wait for new data
  //  from the accelerometer.
  if (accel.available())
  {
    // First, use accel.read() to read the new variables:
    accel.read();

    // accel.read() will update two sets of variables. 
    // * int's x, y, and z will store the signed 12-bit values 
    //   read out of the accelerometer.
    // * floats cx, cy, and cz will store the calculated 
    //   acceleration from those 12-bit values. These variables 
    //   are in units of g's.
    // Check the two function declarations below for an example
    // of how to use these variables.
    printCalculatedAccels();
    //printAccels(); // Uncomment to print digital readings

      // The library also supports the portrait/landscape detection
    //  of the MMA8452Q. Check out this function declaration for
    //  an example of how to use that.
    printOrientation();
    struct {
      int x;
      int y;
      int z;
    } 
    myValues;

    myValues.x = accel.x;
    myValues.y = accel.y;
    myValues.z = accel.z;

    // transmit the struct, use a pointer to it and use 'sizeof' for the length.
    Serial.println(); // Print new line every time.
    // tranmitter code
    //const char *msg = ("x:/n", x, "y:/n", y, "z:/n", z);
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)myValues, sizeof(myValues));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
  }
}
// The function demonstrates how to use the accel.x, accel.y and
//  accel.z variables.
// Before using these variables you must call the accel.read()
//  function!
void printAccels()
{
  Serial.print(accel.x, 3);
  Serial.print("\t");
  Serial.print(accel.y, 3);
  Serial.print("\t");
  Serial.print(accel.z, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.cx, accel.cy,
//  and accel.cz variables.
// Before using these variables you must call the accel.read()
//  function!
void printCalculatedAccels()
{ 
  Serial.print(accel.cx, 3);
  Serial.print("\t");
  Serial.print(accel.cy, 3);
  Serial.print("\t");
  Serial.print(accel.cz, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.readPL()
// function, which reads the portrait/landscape status of the
// sensor.
void printOrientation()
{
  // accel.readPL() will return a byte containing information
  // about the orientation of the sensor. It will be either
  // PORTRAIT_U, PORTRAIT_D, LANDSCAPE_R, LANDSCAPE_L, or
  // LOCKOUT.
  byte pl = accel.readPL();
  switch (pl)
  {
  case PORTRAIT_U:
    Serial.print("Portrait Up");
    break;
  case PORTRAIT_D:
    Serial.print("Portrait Down");
    break;
  case LANDSCAPE_R:
    Serial.print("Landscape Right");
    break;
  case LANDSCAPE_L:
    Serial.print("Landscape Left");
    break;
  case LOCKOUT:
    Serial.print("Flat");
    break;
  }
}

What am I missing?

or would the buffer be easier to use?

A buffer or struct, they are both okay. A struct makes the code look nicer (to me it does).
A struct is just a bunch of variables in a single package.

A struct is like a variable, and you should use the address of the struct: (uint8_t *) &myValues

vw_send((uint8_t *) &myValues, sizeof(myValues));

In the 'c'-language, when you have a very large struct, and you use the struct as a parameter for a function, the complete structure and all its data is used for the parameter. That is why many times a pointer to the struct is used.

The name of an array without index is like a pointer, and using 'buffer' in the next example is already a pointer.

byte buffer[10];
vw_send((uint8_t *) buffer, sizeof(myValues));

Add the '&', and it should work.
In the receiver, you can copy the incoming data into the same struct with memcpy, or you can use a pointer to that struct to 'buf'. You can also use a buffer in the receiver and combine the bytes into integers.

When an integer is transmitted, I think that the low byte is transmitted first (but I'm not 100% sure).

x = word ( buf[1], buf[0]);
y = word ( buf[3], buf[2]);
z = word ( buf[5], buf[4]);

Choose what you feel most comfortable with, and I will check if the code is okay.

I fixed the transmitter code

/*Arduino --------------- MMA8452Q Breakout
 5V  ---------------     3.3V (used a level shifter)
 GND   ---------------     GND
 SDA (A4) --\/330 Ohm\/--    SDA
 SCL (A5) --\/330 Ohm\/--    
 
 pin 9 ------------- tx pin
 vin -------- tranmiter v+
 */
#include <VirtualWire.h>
#include <Wire.h>
#include <SFE_MMA8452Q.h>


MMA8452Q accel;

void setup()
{
  Serial.begin(2400);
  accel.init();
  // or accel.init(SCALE_4G); gives +/- 4g
  //or accel.init(SCALE_8G); give +/- 8g
  //ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12,
  //     ODR_6, or ODR_1. 
  //Sets to 800, 400, 200, 100, 50, 12.5, 6.25, or 1.56 Hz output
  // //accel.init(SCALE_8G, ODR_6);
  vw_setup(2000);      // Bits per sec
  vw_set_tx_pin(9);
}
void loop()
{

  // accelerometer code
  // Use the accel.available() function to wait for new data
  //  from the accelerometer.
  if (accel.available())
  {
    // First, use accel.read() to read the new variables:
    accel.read();

    // accel.read() will update two sets of variables. 
    // * int's x, y, and z will store the signed 12-bit values 
    //   read out of the accelerometer.
    // * floats cx, cy, and cz will store the calculated 
    //   acceleration from those 12-bit values. These variables 
    //   are in units of g's.
    // Check the two function declarations below for an example
    // of how to use these variables.
    printCalculatedAccels();
    //printAccels(); // Uncomment to print digital readings

      // The library also supports the portrait/landscape detection
    //  of the MMA8452Q. Check out this function declaration for
    //  an example of how to use that.
    printOrientation();
    struct {
      int x;
      int y;
      int z;
    } 
    myValues;

    myValues.x = accel.x;
    myValues.y = accel.y;
    myValues.z = accel.z;

    // transmit the struct, use a pointer to it and use 'sizeof' for the length.
    Serial.println(); // Print new line every time.
    // tranmitter code
    //const char *msg = ("x:/n", x, "y:/n", y, "z:/n", z);
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *) &myValues, sizeof(myValues));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
  }
}
// The function demonstrates how to use the accel.x, accel.y and
//  accel.z variables.
// Before using these variables you must call the accel.read()
//  function!
void printAccels()
{
  Serial.print(accel.x, 3);
  Serial.print("\t");
  Serial.print(accel.y, 3);
  Serial.print("\t");
  Serial.print(accel.z, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.cx, accel.cy,
//  and accel.cz variables.
// Before using these variables you must call the accel.read()
//  function!
void printCalculatedAccels()
{ 
  Serial.print(accel.cx, 3);
  Serial.print("\t");
  Serial.print(accel.cy, 3);
  Serial.print("\t");
  Serial.print(accel.cz, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.readPL()
// function, which reads the portrait/landscape status of the
// sensor.
void printOrientation()
{
  // accel.readPL() will return a byte containing information
  // about the orientation of the sensor. It will be either
  // PORTRAIT_U, PORTRAIT_D, LANDSCAPE_R, LANDSCAPE_L, or
  // LOCKOUT.
  byte pl = accel.readPL();
  switch (pl)
  {
  case PORTRAIT_U:
    Serial.print("Portrait Up");
    break;
  case PORTRAIT_D:
    Serial.print("Portrait Down");
    break;
  case LANDSCAPE_R:
    Serial.print("Landscape Right");
    break;
  case LANDSCAPE_L:
    Serial.print("Landscape Left");
    break;
  case LOCKOUT:
    Serial.print("Flat");
    break;
  }
}

But I am lost on how to change my receiver code so I can change the incoming bytes into a struct and then store that struct
on my sd card.

Receiver code

#include <SD.h>
#include <VirtualWire.h>

const int chipSelect = 4;

void setup()
{
  Serial.begin(2400);

  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);      // Bits per sec
  vw_rx_start();      // Start the receiver PLL running
  vw_set_rx_pin(8);  //set receiver pin to 8

    Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
  // make a string for assembling the data to log:
  String dataString = "";

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int i;
    digitalWrite(9, true); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");

    for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);
      Serial.print(" ");
      dataString += (buf[i]);
    }
    Serial.println("");
    digitalWrite(9, false);
  }
  File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

At first glance it seems okay.
Do you receive the data ? And can you open a file and write something ?

For the Slave, I added this to the top as first line:

#include <SPI.h>

Let's expand the Slave sketch and bring the same struct in it.
I would like to declare the structure globally. Before the setup() function:

struct {
  int x;
  int y;
  int z;
} myValues;

After receiving the 'buf', you can copy the buf into the struct.

if (vw_get_message(buf, &buflen)) // Non-blocking
  {
  int i;
  digitalWrite(9, true); // Flash a light to show received good message


  // check if the received data is exactly the size of our struct
  if (buflen == sizeof (myValues))
  {
    // copy the buf to the struct
    // memcpy (destination pointer, source pointer, size in bytes);
    memcpy (&myValues, buf, sizeof(myValues));
  }
  Serial.print("x,y,z = ");
  Serial.print(myValues.x);
  Serial.print(", ");
  Serial.print(myValues.y);
  Serial.print(", ");
  Serial.println(myValues.z);

Writing to a file is the same as writing to the Serial port. You can use 'dataString' as you have now, or use the seperate print function that I use for the serial port and use them also for the file, like : dataFile.print("x,y,z = "); and so on.

So this is my new code

#include <SD.h>
#include <VirtualWire.h>
#include <SPI.h>

const int chipSelect = 4;

struct {
  int x;
  int y;
  int z;
} 
myValues;

void setup()
{
  Serial.begin(2400);

  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);      // Bits per sec
  vw_rx_start();      // Start the receiver PLL running
  vw_set_rx_pin(8);  //set receiver pin to 8

    Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
  // make a string for assembling the data to log:
  String dataString = "";

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int i;
    digitalWrite(9, true); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");
    // check if the received data is exactly the size of our struct
    if (buflen == sizeof (myValues))
    {
      // copy the buf to the struct
      // memcpy (destination pointer, source pointer, size in bytes);
      memcpy (&myValues, buf, sizeof(myValues));
    }
    Serial.print("x,y,z = ");
    Serial.print(myValues.x);
    Serial.print(", ");
    Serial.print(myValues.y);
    Serial.print(", ");
    Serial.println(myValues.z);
   /* for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);
      Serial.print(" ");
      dataString += (buf[i]);
    }
    Serial.println("");
    digitalWrite(9, false); */
  }
  File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.print("x,y,z = ");
    dataFile.print(myValues.x);
    dataFile.print(",");
    dataFile.print(myValues.y);
    dataFile.print(",");
    dataFile.println(myValues.z);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

But on the SD card I get all zeros for the date. I know it is reciving data because I checked the tranmitter and it is working. However I changed the transmitter for debuggin
transmitter

/*Arduino --------------- MMA8452Q Breakout
 5V  ---------------     3.3V (used a level shifter)
 GND   ---------------     GND
 SDA (A4) --\/330 Ohm\/--    SDA
 SCL (A5) --\/330 Ohm\/--    
 
 pin 9 ------------- tx pin
 vin -------- tranmiter v+
 */
#include <VirtualWire.h>
#include <Wire.h>
#include <SFE_MMA8452Q.h>


MMA8452Q accel;

void setup()
{
  Serial.begin(2400);
  accel.init();
  // or accel.init(SCALE_4G); gives +/- 4g
  //or accel.init(SCALE_8G); give +/- 8g
  //ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12,
  //     ODR_6, or ODR_1. 
  //Sets to 800, 400, 200, 100, 50, 12.5, 6.25, or 1.56 Hz output
  // //accel.init(SCALE_8G, ODR_6);
  vw_setup(2000);      // Bits per sec
  vw_set_tx_pin(9);
}
void loop()
{

  // accelerometer code
  // Use the accel.available() function to wait for new data
  //  from the accelerometer.
  if (accel.available())
  {
    // First, use accel.read() to read the new variables:
    accel.read();

    // accel.read() will update two sets of variables. 
    // * int's x, y, and z will store the signed 12-bit values 
    //   read out of the accelerometer.
    // * floats cx, cy, and cz will store the calculated 
    //   acceleration from those 12-bit values. These variables 
    //   are in units of g's.
    // Check the two function declarations below for an example
    // of how to use these variables.
    printCalculatedAccels();
    //printAccels(); // Uncomment to print digital readings

      // The library also supports the portrait/landscape detection
    //  of the MMA8452Q. Check out this function declaration for
    //  an example of how to use that.
    printOrientation();
    struct {
      float x;
      float y;
      float z;
    } 
    myValues;

    myValues.x = accel.x;
    myValues.y = accel.y;
    myValues.z = accel.z;

    // transmit the struct, use a pointer to it and use 'sizeof' for the length.
    Serial.println(); // Print new line every time.
    // tranmitter code
    //const char *msg = ("x:/n", x, "y:/n", y, "z:/n", z);
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *) &myValues, sizeof(myValues));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    Serial.print("x,y,z = ");
    Serial.print(myValues.x);
    Serial.print(", ");
    Serial.print(myValues.y);
    Serial.print(", ");
    Serial.println(myValues.z);
    delay(200);
  }
}
// The function demonstrates how to use the accel.x, accel.y and
//  accel.z variables.
// Before using these variables you must call the accel.read()
//  function!
void printAccels()
{
  Serial.print(accel.x, 3);
  Serial.print("\t");
  Serial.print(accel.y, 3);
  Serial.print("\t");
  Serial.print(accel.z, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.cx, accel.cy,
//  and accel.cz variables.
// Before using these variables you must call the accel.read()
//  function!
void printCalculatedAccels()
{ 
  Serial.print(accel.cx, 3);
  Serial.print("\t");
  Serial.print(accel.cy, 3);
  Serial.print("\t");
  Serial.print(accel.cz, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.readPL()
// function, which reads the portrait/landscape status of the
// sensor.
void printOrientation()
{
  // accel.readPL() will return a byte containing information
  // about the orientation of the sensor. It will be either
  // PORTRAIT_U, PORTRAIT_D, LANDSCAPE_R, LANDSCAPE_L, or
  // LOCKOUT.
  byte pl = accel.readPL();
  switch (pl)
  {
  case PORTRAIT_U:
    Serial.print("Portrait Up");
    break;
  case PORTRAIT_D:
    Serial.print("Portrait Down");
    break;
  case LANDSCAPE_R:
    Serial.print("Landscape Right");
    break;
  case LANDSCAPE_L:
    Serial.print("Landscape Left");
    break;
  case LOCKOUT:
    Serial.print("Flat");
    break;
  }
}

and am getting "x,y,z = -84.00, 288.00, 895.00
-0.022 0.123 0.970 Flat
x,y,z = -23.00, 126.00, 993.00
0.105 0.132 1.021 Flat
x,y,z = 108.00, 135.00, 1046.00
0.343 -0.026 0.924 Flat
x,y,z = 351.00, -27.00, 946.00" for my serial out put. I have two problems now the data on the my struct and the receiving data. I think I can fix the first problem by dividing by 100 but I have nod idea where to start on my second problem.

I'm sorry, I'm too confused now. I don't know which values are from the Slave and which from the Master.

Can you create test values for the Slave ?
Like this:

    myValues.x = accel.x;
    myValues.y = accel.y;
    myValues.z = accel.z;

    // Temporary test values !
    myValues.x = 10;
    myValues.y = 200;
    myValues.z = 4000;

And tell us what the Slave is showing and what the Master is showing.
You can have two instances of the Arduino IDE open at the same time. And connect each with an Arduino board. So you can have to serial monitors side by side to show both the Slave and the Master at the same time.

So, I tried what you said and used the code:

  // testing my values
   myValues.x = 10;
    myValues.y = 200;
    myValues.z = 4000;

In my setup and got the correct data in my sd card so I think the issue lies with coping the code out of the buff and into the struct. I know the receiver is receiving because when I just put the received message into a buffer it got "Got: 0 0 216 193 0 0 246 194 0 192 123 68
Got: 0 0 192 193 0 0 252 194 0 64 125 68
Got: 0 0 216 193 0 0 0 195 0 64 125 68
Got: 0 0 152 193 0 0 2 195 0 0 122 68
Got: 0 0 104 194 0 0 34 195 0 0 126 68
Got: 0 0 216 193 0 0 178 194 0 192 126 68
Got: 0 0 234 66 0 0 98 195 0 128 124 68
Got: 0 128 166 67 0 0 42 196 0 160 210 68"
Which seems right so how do I copy it onto the sd card?

Which seems right so how do I copy in onto the sd card?

After you've opened a file on the SD card:

myFile.println("in");

Posting the code you have now, with a better description of what "in" is, will, most likely, get you better answers, where better == less-smart-assed.

Posting the code you have now, with a better description of what "in" is, will, most likely, get you better answers, where better == less-smart-assed.

Alright heres my tranmitter code:

/*Arduino --------------- MMA8452Q Breakout
 5V  ---------------     3.3V (used a level shifter)
 GND   ---------------     GND
 SDA (A4) --\/330 Ohm\/--    SDA
 SCL (A5) --\/330 Ohm\/--    
 
 pin 9 ------------- tx pin
 vin -------- tranmiter v+
 */
#include <VirtualWire.h>
#include <Wire.h>
#include <SFE_MMA8452Q.h>


MMA8452Q accel;

void setup()
{
  Serial.begin(2400);
  accel.init();
  // or accel.init(SCALE_4G); gives +/- 4g
  //or accel.init(SCALE_8G); give +/- 8g
  //ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12,
  //     ODR_6, or ODR_1. 
  //Sets to 800, 400, 200, 100, 50, 12.5, 6.25, or 1.56 Hz output
  // //accel.init(SCALE_8G, ODR_6);
  vw_setup(2000);      // Bits per sec
  vw_set_tx_pin(9);
}
void loop()
{

  // accelerometer code
  // Use the accel.available() function to wait for new data
  //  from the accelerometer.
  if (accel.available())
  {
    // First, use accel.read() to read the new variables:
    accel.read();

    // accel.read() will update two sets of variables. 
    // * int's x, y, and z will store the signed 12-bit values 
    //   read out of the accelerometer.
    // * floats cx, cy, and cz will store the calculated 
    //   acceleration from those 12-bit values. These variables 
    //   are in units of g's.
    // Check the two function declarations below for an example
    // of how to use these variables.
    printCalculatedAccels();
    //printAccels(); // Uncomment to print digital readings

      // The library also supports the portrait/landscape detection
    //  of the MMA8452Q. Check out this function declaration for
    //  an example of how to use that.
    printOrientation();
    struct {
      float x;
      float y;
      float z;
    } 
    myValues;

    myValues.x = accel.x;
    myValues.y = accel.y;
    myValues.z = accel.z;

    // transmit the struct, use a pointer to it and use 'sizeof' for the length.
    Serial.println(); // Print new line every time.
    // tranmitter code
    //const char *msg = ("x:/n", x, "y:/n", y, "z:/n", z);
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *) &myValues, sizeof(myValues));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    Serial.print("x,y,z = ");
    Serial.print(myValues.x/1000); 
    Serial.print(", ");
    Serial.print(myValues.y/1000);
    Serial.print(", ");
    Serial.println(myValues.z/1000);
    delay(200);
  }
}
// The function demonstrates how to use the accel.x, accel.y and
//  accel.z variables.
// Before using these variables you must call the accel.read()
//  function!
void printAccels()
{
  Serial.print(accel.x, 3);
  Serial.print("\t");
  Serial.print(accel.y, 3);
  Serial.print("\t");
  Serial.print(accel.z, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.cx, accel.cy,
//  and accel.cz variables.
// Before using these variables you must call the accel.read()
//  function!
void printCalculatedAccels()
{ 
  Serial.print(accel.cx, 3);
  Serial.print("\t");
  Serial.print(accel.cy, 3);
  Serial.print("\t");
  Serial.print(accel.cz, 3);
  Serial.print("\t");
}

// This function demonstrates how to use the accel.readPL()
// function, which reads the portrait/landscape status of the
// sensor.
void printOrientation()
{
  // accel.readPL() will return a byte containing information
  // about the orientation of the sensor. It will be either
  // PORTRAIT_U, PORTRAIT_D, LANDSCAPE_R, LANDSCAPE_L, or
  // LOCKOUT.
  byte pl = accel.readPL();
  switch (pl)
  {
  case PORTRAIT_U:
    Serial.print("Portrait Up");
    break;
  case PORTRAIT_D:
    Serial.print("Portrait Down");
    break;
  case LANDSCAPE_R:
    Serial.print("Landscape Right");
    break;
  case LANDSCAPE_L:
    Serial.print("Landscape Left");
    break;
  case LOCKOUT:
    Serial.print("Flat");
    break;
  }
}

And my receiver code:

#include <SD.h>
#include <VirtualWire.h>
#include <SPI.h>

const int chipSelect = 4;

struct {
  int x;
  int y;
  int z;
} 
myValues;

void setup()
{
  /* testing my values
   myValues.x = 10;
    myValues.y = 200;
    myValues.z = 4000;
  */
  Serial.begin(2400);

  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);      // Bits per sec
  vw_rx_start();      // Start the receiver PLL running
  vw_set_rx_pin(8);  //set receiver pin to 8

    Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
  // make a string for assembling the data to log:
  String dataString = "";

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int i;
    digitalWrite(9, true); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");
    // check if the received data is exactly the size of our struct
    if (buflen == sizeof (myValues))
    {
      // copy the buf to the struct
      // memcpy (destination pointer, source pointer, size in bytes);
      memcpy (&myValues, buf, sizeof(myValues));
    }
    Serial.print("x,y,z = ");
    Serial.print(myValues.x);
    Serial.print(", ");
    Serial.print(myValues.y);
    Serial.print(", ");
    Serial.println(myValues.z);
   /* for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);
      Serial.print(" ");
      dataString += (buf[i]);
    }
    Serial.println("");
    digitalWrite(9, false); */
  }
  File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.print("x,y,z = ");
    dataFile.print(myValues.x);
    dataFile.print(",");
    dataFile.print(myValues.y);
    dataFile.print(",");
    dataFile.println(myValues.z);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

As for the in is it is supposed to be a setup like "x,y,z = (accelerations separated by commas)"

As for the in is it is supposed to be a setup like "x,y,z = (accelerations separated by commas)"

So, what is the problem? Aside from the fact that you write to the card on every pass through loop, even when there is nothing new to write.

Ok so the problem is that when I run the receiver it stores x,y,z = 0,0,0 on the sd card when I know it is receiving date.

Ok so the problem is that when I run the receiver it stores x,y,z = 0,0,0 on the sd card when I know it is receiving date.

Have you fixed the problem where it is writing to the file on every pass through loop(), not just the ones when it receives data?

Yeah I fixed it. I moved the brackets of the if loop around the data file write section
So my new code is

#include <SD.h>
#include <VirtualWire.h>
#include <SPI.h>

const int chipSelect = 4;

struct {
  int x;
  int y;
  int z;
} 
myValues;


const int ledPin = 9;
int ledState= LOW;

long interval = 1000;
long previousMillis = 0; 
void setup()
{
  pinMode(ledPin, OUTPUT);
  /* testing my values
   myValues.x = 10;
   myValues.y = 200;
   myValues.z = 4000;
   */
  Serial.begin(2400);

  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);      // Bits per sec
  vw_rx_start();      // Start the receiver PLL running
  vw_set_rx_pin(8);  //set receiver pin to 8

    Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop()
{
   unsigned long currentMillis = millis();
  // make a string for assembling the data to log:
  String dataString = "";

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
        if(currentMillis - previousMillis > interval) {
      // save the last time you blinked the LED 
      previousMillis = currentMillis;   

      // if the LED is off turn it on and vice-versa:
      if (ledState == LOW)
        ledState = HIGH;
      else
        ledState = LOW;

      // set the LED with the ledState of the variable:
      digitalWrite(ledPin, ledState);
    }
    int i;
    digitalWrite(9, true); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");
    // check if the received data is exactly the size of our struct
    if (buflen == sizeof (myValues))
    {
      // copy the buf to the struct
      // memcpy (destination pointer, source pointer, size in bytes);
      memcpy (&myValues, buf, sizeof(myValues));
    }
    Serial.print("x,y,z = ");
    Serial.print(myValues.x);
    Serial.print(", ");
    Serial.print(myValues.y);
    Serial.print(", ");
    Serial.println(myValues.z);
    /* for (i = 0; i < buflen; i++)
     {
     Serial.print(buf[i]);
     Serial.print(" ");
     dataString += (buf[i]);
     }
     Serial.println("");
     digitalWrite(9, false); */
    File dataFile = SD.open("datalog.txt", FILE_WRITE);

    // if the file is available, write to it:
    if (dataFile) {
      dataFile.print("x,y,z = ");
      dataFile.print(myValues.x);
      dataFile.print(",");
      dataFile.print(myValues.y);
      dataFile.print(",");
      dataFile.println(myValues.z);
      dataFile.close();
      // print to the serial port too:
      Serial.println(dataString);
    }  
    // if the file isn't open, pop up an error:
    else {
      Serial.println("error opening datalog.txt");

    }
  }
 if(currentMillis - previousMillis > interval && ledState == HIGH) {
        ledState = LOW;

      // set the LED with the ledState of the variable:
      digitalWrite(ledPin, ledState);
    } 
}