but why dont we do another way around like
sem_init(&shared.full, 0, BUFF_SIZE);
sem_init(&shared.empty, 0, 0);
I think there is another reason for that but I can not get it...
Type: Posts; User: thungmail
but why dont we do another way around like
sem_init(&shared.full, 0, BUFF_SIZE);
sem_init(&shared.empty, 0, 0);
I think there is another reason for that but I can not get it...
typedef struct {
int buf[BUFF_SIZE]; /* shared var */
int in; /* buf[in%BUFF_SIZE] is the first empty slot */
int out; /* buf[out%BUFF_SIZE] is the first full...
If I declare
char* sche = "Sep 29, 19:34";
Then I can extract each char from "sche" by iterating through "sche.However if I try to use strtok() on schelike following
char delim[] =...
int main()
{
char* date1="Dec 29, 8:30";
char* date2="Dec 28, 7:30";
char* year =" 2009";
strcat(date1,year);
strcat(date2,year);
return 0;
}
char* sche = "Sep 29, 19:34";
char sche[] = "Sep 29, 19:34";
I would like to ask that 2 lines of codes above are the same meaning in C.What is the meaning of the first code and the...
No iam sorry it is my fault. Thanks
char array[] = "Sep 29, 19:34";
i use strlen() to find the length of array
red 429 %array.out
length of array is 3
red30 %
The length should be 13. I dont understand why. I need an...
Thanks for that. To get each month from above array,I use array[i].Is there any other ways to get a month from this array. Can i use
*(arr+i).The compiler gives me an error for this
I want to declare an array to hold 12 month from Jan to Dec. I am coding like this
char arr[] ={
"Jan", "Feb",
"Mar", "Apr",
"May", "Jun",
"Jul", "Aug",
"Sep",...
@slingerland3g: >='a' and <='z' can help me.
@King Mir : what do you mean pass char as an integer. Could you explain pls
Thanks all
That is what i have just coded
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main ( int argc , char* argv[])
{
char* s = "CPROGRAMMING";
int i;
If we have a string like "CPROGRAMMING"
How can we check if this string contains only
1. Capital letters
2. No digits
Thanks
Thanks a lot
Thanks for your anwsers. I am clear now
ok now i am using malloc
input = (char*)( malloc(sizeof(char))
Now the problem is on malloc(sizeof(char) because it does not make sure the bounds of the input unless we have to declare a...
4. fgets ( input ,43, stdin ) ;
I declare 43 bytes because i want to make sure that there is enough for the string from stdin. If i made a small change at line 2
char input[43];
It will...
There is another question I want to ask about the fgets() in C. Here is my code
#include <string.h>
#include <stdio.h>
1.int main (int argc, char *argv[]){
2. char* input;
3. char* arg;...
Thanks a lot it is clear now
There is another question I want to ask about the fgets() in C. Here is my code
#include <string.h>
#include <stdio.h>
1.int main (int argc, char *argv[]){...
Thanks for all your answers.
For the problem above, according to laserlight
I made a small change
printf("%s\n",*a[1]);
But still get the error.
This error still occurs when I try an...
thanks for your help but i still feel confused if i use
printf("%s\n",&a[1]);
it will give me
ello, World!
There is code in C
int main(void)
{
char *a = "Hello, World!";
printf("%s\n",&a[1]);
return 0;
}
Thanks for your answers all.They are very useful to me know.
Tuan
There are codes about pthread in C
1.#include <pthread.h>
2.#include <stdlib.h>
3.#include <unistd.h>
4.void *thread_function(void *arg) {
5. printf("Thread says hi!\n");
6. ...
I have 2 different directories. The first has 2 sub-folders A and B. The second as 2 sub-folders C and D and script named "script".There is a code of "script" to list 2 sub-folders C and D
...
hi
How can i list files which are only folders in Unix
Tuan