Rockbox mail archive
Subject: Re:Dereferencing Coding Help
From: Chris Muth (muthchris_at_muth.cc)
What does mpeg_current_track(); return? Does it setup a storage location and then return a pointer to it?
From the snippet I see, I don't see a storage location, just a pointer to a storage location.
Also, the function must also populate the entire struct, or well, at least the id3->path field.
Just some thoughts. Hope this helps.
Original message from: Benjamin
>I'm trying to implement a bookmark capability in RockBox, but I'm
>running into a problem. Below is the code snippet. When I compile
>with this, I recieve the error "dereferencing pointer to incomplete
>type" at the write line. I'm not sure why. Any help is appreciated.
> int f;
> f = open ("/bookmark.txt", O_RDWR | O_CREAT | O_TRUNC);
> if(f >= 0)
> struct mp3entry *id3 = NULL;
> id3 = mpeg_current_track();
> write (f, id3->path, MAX_PATH); // <--Error causing line
> close (f);
> bool done = false;
> int key;
> char buffer;
> snprintf(buffer, sizeof(buffer), " Failed: %2d", f);
> int y=0;
> lcd_puts(0, y++, buffer);
> /* Wait for a key to be pushed */
> key = button_get_w_tmo(HZ*5);
> case BUTTON_LEFT | BUTTON_REL:
> case BUTTON_OFF | BUTTON_REL:
> done = true;
Page was last modified "Jan 10 2012" The Rockbox Crew