April 9th, 2013, 04:01 PM
Re: Help with C simple loop.
As far as the more than 512 bytes, for what I am doing in this program and knowing that arrays cannot be dynamic in nature for 'C', I think my best bet is to just control the data that is in that array to make sure that a NULL or more than 512 bytes are not fed into the function. I know this is not the best way, but for this assignment, it will get me by.
Originally Posted by Paul McKenzie
Sorry about that, I changed it to return NULL; and changed my if statement below that.
As of right now, everything is working and the debugger helped a great deal! The only issue I am having now is:
I can't get this loop to break when I enter "N" at the prompt. It seems to completely skip the if true and false values and just continue running the while(1) loop. Am I missing something simple? I am just trying to continue the loop until the user enters anything other than Y or y. In the debugger, the value is getting put in "cont", but it just skips the continue or break on that if statement.
printf("Checking which server to use.\n");
if (getServer(svrList) != "0")
printf("The server is %s\n",server_name);
printf("Do you want to continue? [Y/N]");
if (cont = "Y" || "y")
printf("There are no available servers!\n");
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!