Sorry, I needed to delete this post.
Type: Posts; User: m88g88
Sorry, I needed to delete this post.
This seems like a really good idea for learning programming and you help others in the process. Maybe I'll do that when I have time to learn it properly lol.
I haven't had time to learn to code...
Lol it's okay. Have everything. It's not mine!
Thank you, Adam!
The help I have received from this forum is amazing. Can I ask everyone your motivation for helping people on here? Is it purely out of satisfaction from helping people?
Thanks for the extra information!
And no, I haven't changed all my gets to fgets, but it seems to work okay for now, so I will go back to that later (need to look up how fgets works first).
I...
char *ptr;
strchr((const char*)asearch,'\n');
ptr[0] = '\0';
This does work, but how would you code it so that it does not include 'const char*' (as zac7 said it would happen automatically)....
Thank you, this worked!!! :D
Now I know more about strings, and with all the info provided in this thread, I should be able to complete the program easily.
Thank you for your replies.
I have have done my best to make these corrections. I have turned the 'asearch' variable into:
char asearch[15]
I have changed the code for searching an array to:
{
printf("Search for which song??: \n\n");
...
Thank you, jeffcob!
You explained this really well. I have heard of a couple of things (such as strcmp()) and have a book for my module which will explain all this. I was not aware that you would...
Hello! I have been spending the last 3 days trying to work out why my program crashes after trying to search an array.
This happens after using the switch to get to 'Manage>Search Track'. It will...
strcmp(songs[i], aremove)==0;
And I am told 'incompatible type for argument 1 of 'strcmp'.
FYI, this is the declaration of 'aremove' (other variables have been deleted to make this shorter).
I didn't realise 'remove' is a standard function, so have renamed it to 'aremove'. I called it that because once I get this working, I want to try change it so that it can remove a song in the...
Hello!
I am trying to create a loop that searches a struct array for the value of 'remove' (which is a char).
Struct:
typedef struct
Thank you! This worked. I am really grateful :D
Thanks, quzah, but what are you referring to with 'foo'?
I have tried entering those 'printf's in different way, but am unable to get them to work. I am very new to programming, so sorry if this...
I have yet another question!
How would you display the contents of struct?
typedef struct
{
char track[20];
Finally got the code to work!
For some reason I had made a duplicate of a 'for()' and I'm not sure what else was done to fix it. A friend fixed it and he did it too quickly!
Thank you all for...
Thanks all to your replies. I tried all these, but could not sort the problem out -probably because I don't have much programming experience and didn't do it properly.
However, the code on its own...
Thank you, ZuK. The code stopped that problem. It now says: syntax error before ']' token.
I am assuming that that is because you said I would have to define the array of song before I use it,...
Trying to scanf to a struct, but when compiling, I am given: 'request for member 'track' in something not a structure or union.
I have looked around on the internet and one suggestion was to...
Thank you, iMalc!. I'll look into this. We haven't even learnt about buffering yet, but I have a rough idea, so this will be useful when I've looked into it!
Thank you SO much Salem! This makes more sense than the rubbish I wrote lol.
The purpose of this code is to let the user enter a name of a song into a string, which can then be buffered and played into a program called 'mplayer'.
#include <stdio.h>
#include...
Thank you so much! This works :D I'll experiment with it get to understand it, but it helps to understand how to do something when it's done first.
I am really grateful!!!