The select function tests for read/write/error conditions on file descriptors. Here's an example that waits 10 seconds for you to enter some data via STDIN, before giving up:
(its from the faq)
...
Type: Posts; User: Hammer
The select function tests for read/write/error conditions on file descriptors. Here's an example that waits 10 seconds for you to enter some data via STDIN, before giving up:
(its from the faq)
...
http://cboard.cprogramming.com/showthread.php?t=46333#postmenu_321434
Don't know if this has been posted before or not...
http://members.iinet.net.au/~pontipak/redsquare.html
My best so far is 19 seconds.
[edit]
Now 20.875 seconds :)
>char type;
>type = fgetc(stdin)
fgetc() doesn't return a char, it returns an int.
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351
Maybe use Response.End
http://www.w3schools.com/asp/met_end.asp
http://www.w3schools.com/asp/asp_ref_response.asp
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1073433376&id=1073086407
In addition to my last post, the following will produce a list of all customers with last transaction date, including customers that don't have any transactions. In the latter case, the Max trans...
One way:
SELECT customers.account, Max(transactions.transactiondate) AS MaxOftransactiondate
FROM customers INNER JOIN transactions ON customers.account = transactions.account
GROUP BY...
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043372399&id=1043284385
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1045691686&id=1043284392
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385
You must error check fopen() and fscanf().
inp = fopen("junk1.txt", "r");
if (inp == NULL)
{
perror("fopen");
...
}
>>Make those variables global
... and they need to be global because ... ?
In general terms, only use global variables if you need to share data between functions, and the design makes it hard...
>>are there any solution to make the random function just generates once
Sure, just call it once. You'd need to make the variables static if you want to retain their values from one function call...
It's getting confused by the newline characters that are output as part of the gcc --version command. Here's one solution:
$ gcc -DGCCVERSION="\"$(gcc --version|tr '\n' ' ')\"" junk1.c
$...
... Sending car around where needed. The variable is too small and the program requirements are too simplistic to warrant a pointer at this stage.
Global variables should be your last choice. ...
>>I suggest that you make [car] a global variable.
I don't. Learn how to program properly from day one, don't bodge your program just to be lazy.
Forgetting the setup process, the addition of all the sides can be peformed using only one loop. For now, I'll leave it to you to figure out how ;)
Also, are you sure your program does what you...
int displayval()
{
char car;
printf("Character: %c\t ascii: %u\t hex: %#X\n", car, car, car);
return (0);
}
And what value do you expect car to have when printf() does it's work...
>> char car;
>> car = getc(stdin);
getc() returns an int, not a char. You compiler should be warning you of such errors, if it isn't, turning up the warning levels!
The displayval()...
Why would calling an additional function make it easier?
... and no, it wouldn't work anyway (see the comments above about NULL pointer initialisation)
[goddamit, beat!]
Did you read: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042834793&id=1043284351 ?
Then dump the initFunction completely, and just use the alloc:
Matrix *allocMatrix(int row, int col)
{
Matrix *m;
m = malloc(sizeof(*m)); /* Error check! */
int i = 0;
getchar() reads from stdin (normally the keyboard). If you want to read from the file, use fgetc() and pass it your fp variable.
You have junk in the input buffer, 'cos you're using scanf() to get the number. Two choices:
Change the way you get the number:...
How did you get the file from your Windows machine to the *nix one?
If you ftp it, using standard text mode transfer (normally default), then the CRLFs will be converted, meaning that CRLF on...