Using Structs and PROGMEM

Hi. I want to have a struct that contains a string, and a array of ints. And then I want to read those values. Here's what I've managed to do so far.

typedef struct MyStruct 
{ 
 int num; 
 const char * mad; 
 
} MyStruct;

struct MyStruct PROGMEM_getAnything (const struct MyStruct * sce)
  {
  static struct MyStruct temp;
  memcpy_P (&temp, sce, sizeof (MyStruct));
  return temp;
  }
  
const char text[] PROGMEM ="help";
const MyStruct test PROGMEM = {5, text};

void setup() 
{
  Serial.begin(9600);
  struct MyStruct test2 = PROGMEM_getAnything (&test);
  Serial.println(test2.num);
    
}  // end of setup

void loop() { }

When I do Serial.println(test2.num); I get the right number. But when I do Serial.println(test2.mad); nothing comes up. Does anyone know whats going on?

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Did you cast test2.mad to a __FlashStringHelper* ?

(It would be helpful if you would post a complete sketch that illustrates the problem.)

This is all my code :slightly_frowning_face: All I want to to is read strings from structs in PROGMEM. I'm very confused why memcpy_P is not working because, as I understand it, it literally just copies the bytes.

Nick your page was super helpful but I have one more question. I was a store an array of ints in a struct in PROGMEM. Is this the correct way?

struct MyStruct
{
	uint8_t num_ingredients_;
	uint8_t drink_ID[6];
	uint8_t ratios[6];
};


const struct MyStruct drinkA PROGMEM = {3, {1, 2, 3}, {1, 1, 2} }

Will there all go in progmem correctly?

I think so, apart from the missing semicolon. Why not try it and see?