Try using a while loop:
while (fahrenheit > 300) {
// Do stuff...
}
Don't forget to change fahrenheit every iteration.
Type: Posts; User: kpreston
Try using a while loop:
while (fahrenheit > 300) {
// Do stuff...
}
Don't forget to change fahrenheit every iteration.
fgets needs to collect data as long as the bot is connected to the server (which, ideally, is 24/7). It only stops when one of the users on the server issues the !quit command. But by that point it's...
Appologetic bump. :(
AFAIK I don't have either of those options available to me. :( It seems the only option I have right now is to remove the fgets. Now, how can I have handle:
while (running) {
...
}
...
It still leaves the window open until I hit enter. :(
Do you know of any quick and dirty ways to just end the program?
I'm porting it to linux after completion. And no, I can't write to stdin. That was just a wild guess, before doing research.
I'm not printing to stdin. I'm closing stdin, and trying to print to stdout. Once fclose is called, nothing is printed. The line before the fclose call prints, but nothing after. Also, stdin is not...
if (fclose(stdin) == 0) {
printf("LOLSUCCESS\n");
} else {
printf("error: %d\n", errno);
}
printf("blah\n");
Prints nothing. :(
I have to hit enter before it breaks, which makes sense. I'm just trying to find a way around it.
I already mentioned how cmd_quit is being called. The issue has nothing to do with my running variable, and everything to do with fgets.
The thread receiving data from the server.
I thought exit() would simply close the program. :|
running = 0 is ment to break the loop. The problem is that fgets is blocking. I've tried select, which doesn't work on nonsockets in Windows....
while (running) {
fgets(buffer, 128, stdin);
if (buffer[strlen(buffer) - 1] == '\n') { buffer[strlen(buffer) - 1] = '\0'; }
for (i = 0; i < bots[0].count; i++) {
sprintf(sendbuf,...
When should I start breaking up a file and putting similar functions in their own headers? How big is too big?
Okay. Thank you, master5001.
Oops. Good catch. Didn't notice my typo.
Nifty. Thank you all for the quick responses. :)
Critic my coding, please:
It appears to work, but it looks pretty damn gross.
int strircmp(const char *s1, const char *s2) {
// Compare right hand side of s1 with s2, case insensitively...
Exactly.
Compare. Similar to strnicmp, only the reverse...
const char *s1 = "LOloLOLOLOLoLOL blAh";
const char *s2 = "blah";
How can I compare the right hand side of s1 to s2, case insensitively? Is there a standard function for this, or will I need to...
That's what I was wondering. Since ParseData isn't a thread, I wasn't sure if it was going to bottleneck at those function calls. And I don't have any trouble with syncronization so far. Each thread...
I'm working on a chat client. Basically, I want to convert what I have now to a multi-threaded version. I'm having a hard time understanding the concept, however.
ParseData(SOCKET, char *);...
Ended up using a linked list for this reason.