thanks for the help with the prototype.
I do have a "timefinished", and I have just realised I dont need them as global variables.
P.S. Whats the significants of the astrix symbol in this, I...
Type: Posts; User: sweetorangepie
thanks for the help with the prototype.
I do have a "timefinished", and I have just realised I dont need them as global variables.
P.S. Whats the significants of the astrix symbol in this, I...
Thanks for that dave, thats got it working!!!
How would I make a function prototype for that kind of function, i've never used them before.
Also I need to have timestarted as a global variable...
thanks for the help,
This has stoped the errors but i'm getting a new one now:
423: warning: return makes integer from pointer without a cast
The line of code which this is refering to is:
I'm having some trouble getting a function to work, can anyone help.
I've got a function that gets the current time and i'm trying to return the value into a variable. This is the function at...
matsp i've just tried what you suggested and it compiles but nothing happens? I'm not sure if what you suggested will do what I need, what I need is something that will get the current system date...
I'm making a log file for my program and I need to inset a time and date stamp. I've had a look through the GNU C Libary and found the gettimeofday function but I'm having a little trouble...
Todd Burch, you my friend are a legend, 300 lines of code and all that was wrong was 1 digit, I hate C....
I'm trying to write some code which will take the value from one variable ( multiple guesses ), format it and split it up into diffrent variables (one for each guess). I have a set of if statements...
This is the simplest version of what i'm trying to achieve:
int main (void)
recent = show_recent(guess);
if (0 != recent){
printf("\n%s", recent_guess1);
printf("%s",...
i have now changed it to:
return ((strcmp(checkvalue, "recent") == 0)||(strcmp(checkvalue, "RECENT") == 0)||(strcmp(checkvalue, "Recent") == 0));
but it is no longer returning a 1, what am i...
I've just figured out thats what the number 1 was doing in that. How would i use strcmp, just the same but without the number at the end?
Thanks Again
I'm using strncmp to return a 1 if the user has typed in recent:
return ((strncmp(checkvalue, "recent", 1) == 0)||(strncmp(checkvalue, "RECENT", 1) == 0)||(strncmp(checkvalue, "Recent", 1) ==...
I have a function which is giving me an error:
error: called object is not a function
The function which the error is relating to is this one:
int show_recent( char* checkvalue )
{
if...
well that was a stupid mistake,
Thanks for fixing that!!!
I'm having some trouble with this switch loop:
switch (guess_counter)
{
case 1;
strcpy (recent_guess1, user_input);
guess_counter++;
break;
case 2;
This is what the code is now:
do{
printf("---Welcome to Mastmind--- \n");
printf("Please enter your name: ");
fgets(username, 20, stdin);
exit_check =...
ok I understand now, sorry about my noobyness, I think I can get it to work now, is there anyway of breaking out of a loop while in another function???
Thanks Guys, Appriciate it
thanks for the help with that and I understand how that would work and have added the changes that you have suggested but it still doesn't work, it just goes to the next line of the code. Do you...
oh fair enougth I see, where should I put the break, should this go in the end game function as the program goes there if exit has been typed???
Thanks for your help, its much appriciated.
ok so it never actualy stops. So is there something wrong with my loop then, I dont understand why it works in the mock up and not in my main code, can anyone explain this.
Thanks
ok i have made some changes, and from what I understand a C program will close when it gets to the end of the main function. The exit check is used in a loop around the program which carry's on so...
I have changed the strncmp to check 4 letters but this has made no diffrence. I have also removed that line and it still has no effect, i'm attaching the full code to see if it would help.
I've just tried adding \n to the strncmp but it didn't make a diffrence. The reason it changes username to checkvar is becuase i will use the function to check variables other than username later...
Hi, I'm writing a program for an assignment are that you are able to exit the program at anytime by typing exit. I have created a mockup where is passes the variable you want to check says exit...