user_id
stringlengths 24
24
| time
stringlengths 24
24
| feature_type
stringclasses 5
values | feature_version
stringclasses 2
values | input_question
stringlengths 1
1.24k
⌀ | input_code
stringlengths 2
18.5k
⌀ | input_intention
stringlengths 1
2.48k
⌀ | input_task_description
stringlengths 18
3.32k
⌀ |
---|---|---|---|---|---|---|---|
63c647b55f004bf4898cf603 | 2023-03-15T18:32:04.009Z | Help Fix Code | v2 | read an action line of a makefile and turn it into a struct action_node | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
if(is_action(fp_line) == 1){
char **act_args = malloc(sizeof(char **));
char *action_token = strtok(fp_line, " \t");
action_token = strtok(NULL, " \t");
while(action_token != NULL){
continue;
action_token = strtok(NULL, " \t");
}
Action *a = create_action_node(act_args);
add_action_node(current_rule, a);
} | null | null |
63c647b55f004bf4898cf603 | 2023-03-15T18:36:18.220Z | Help Fix Code | v2 | go through an action line in the makefile and turn the actions into a char **, and create a struct_action_node | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
if(is_action(fp_line) == 1){
char **act_args;
char *action_token = strtok(fp_line, " \t");
action_token = strtok(NULL, " \t");
int act_count = 0;
while(action_token != NULL){
act_count += 1;
action_token = strtok(NULL, " \t");
}
act_args = malloc(act_count * sizeof(char *));
Action *a = create_action_node(act_args);
add_action_node(current_rule, a);
}
/* Create a new action node.
* Return a pointer to this action node.
*/
Action *create_action_node(char **args){
Action *new_action_node = malloc(sizeof(Action));
return new_action_node;
}
| null | null |
63c647b55f004bf4898cf603 | 2023-03-15T18:42:37.267Z | Help Write Code | v2 | null | null | null | write code to turn an action line of a makefile into an array of strings |
63c647b55f004bf4898cf603 | 2023-03-15T18:50:31.020Z | Help Write Code | v2 | null | null | null | get the number of actions in an action line of a makefile using strtok |
63c647b55f004bf4898cf603 | 2023-03-15T18:52:15.370Z | Explain Code | v2 | null |
char *args_to_string(char **args, char *buffer, int size) {
buffer[0] = '\0';
int i = 0;
while (args[i] != NULL) {
strncat(buffer, args[i], size - strlen(buffer));
strncat(buffer, " ", size - strlen(buffer));
i++;
}
return buffer;
}
| null | null |
63c647b55f004bf4898cf603 | 2023-03-15T19:15:54.177Z | General Question | v2 | what should the parameters of fgets be when reading through the file pointed to by a file pointer | null | null | null |
63c647b55f004bf4898cf603 | 2023-03-15T19:25:11.498Z | Help Fix Code | v2 | go through an action line in the makefile and turn the actions into a char **, and create a struct_action_node | if(is_action(fp_line) == 1){
int num_actions = 0;
// number of actions
char *line_copy = NULL;
strcpy(line_copy, fp_line);
char **temp_args = NULL;
char *aa = strtok(line_copy, " \t");
while(aa != NULL){
num_actions += 1;
aa = strtok(NULL, " \t");
}
// actually building it
char **act_args = malloc((num_actions + 1) * sizeof(char *));
char *action_token = strtok(fp_line, " \t");
action_token = strtok(NULL, " \t");
int index = 0;
while(action_token != NULL){
act_args[index] = action_token;
action_token = strtok(NULL, " \t");
}
Action *new_action_node = create_action_node(act_args);
add_action_node(current_rule, new_action_node);
} | null | null |
63c647b55f004bf4898cf603 | 2023-03-15T19:26:54.817Z | Help Write Code | v2 | null | null | null | get the number of actions in the action line of a makefile
|
63c647b55f004bf4898cf603 | 2023-03-15T19:28:35.462Z | Help Write Code | v2 | null | null | null | Intended Behavior: get the number of actions in the action line of a makefile without modifying the makefile AT ALL |
63c647b75f004bf4898cf617 | 2023-01-24T06:22:56.133Z | General Question | v1 | what does (.text+0x1b): undefined reference to `main' mean | null | null | null |
63c647b75f004bf4898cf617 | 2023-02-11T21:15:28.191Z | Question from Code | v1 | What is this code doing? | ((var |= 1 <<(flag))) | null | null |
63c647b75f004bf4898cf617 | 2023-02-11T21:18:04.171Z | Explain Code | v1 | null | ((var) & (1 << (flag))) | null | null |
63c647b75f004bf4898cf617 | 2023-02-12T00:34:10.073Z | Explain Code | v1 | null | char * (*x) (char *) = my_func; | null | null |
63c647b75f004bf4898cf617 | 2023-02-12T00:38:52.369Z | Question from Code | v1 | why (*x)?
| char * (*x) (char *) = my_func; | null | null |
63c647b75f004bf4898cf61c | 2023-01-24T22:25:51.469Z | General Question | v1 | how does scanf treat white spaces | null | null | null |
63c647b75f004bf4898cf61c | 2023-01-26T01:53:18.076Z | Help Fix Code | v1 | null | void update_contact(struct *contact, char *new_name, int number, char *address){
strcpy(contact->name, new_name);
contact->phone_number= number;
strcpy(contact->address, address);
}
| modify struct using pointer | null |
63c647b75f004bf4898cf61c | 2023-01-26T18:08:37.740Z | Help Fix Code | v1 | null | struct node{
int value;
struct node *next;
} | create struct with value and pointer t next node | null |
63c647b75f004bf4898cf61c | 2023-01-27T19:49:56.283Z | Help Fix Code | v1 | null | &((*argc)+1); | pointer arithmetic and then taking the address of result | null |
63c647b75f004bf4898cf61c | 2023-01-27T19:51:31.861Z | Explain Code | v1 | null | &((*argc)+1); | null | null |
63c647b75f004bf4898cf61c | 2023-01-27T19:52:12.999Z | Help Fix Code | v1 | null | &((*argv)+1); | does pointer arithmetic then takes address of result | null |
63c647b85f004bf4898cf621 | 2023-01-18T22:37:07.814Z | General Question | v1 | what does it mean when standard input is closed in c | null | null | null |
63c647b85f004bf4898cf621 | 2023-01-18T22:39:28.154Z | General Question | v1 | how do you close standard input in c | null | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T19:33:21.843Z | Question from Code | v2 | given the provided struct and code, why does the malloc call cause a segmentation fault | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
action->args = malloc(sizeof(char *) * (9)); | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T19:44:37.759Z | Question from Code | v2 | given the provided struct and code, why does the malloc call cause a segmentation fault | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
action->args = malloc(sizeof(char **) * (9)); | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T19:45:26.333Z | Help Fix Code | v2 | is there a problem with this code | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
action->args = malloc(sizeof(char *) * (9)); | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T19:46:59.573Z | Help Fix Code | v2 | action->args should have space allocated for 9 strings | typedef struct action_node {
char **args; // An array of strings suitable to be passed to execvp
struct action_node *next_act;
} Action;
action->args = malloc(sizeof(char *) * (9)); | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T21:44:17.408Z | General Question | v2 | what does the function strtok do to the string it is called on | null | null | null |
63c647b85f004bf4898cf621 | 2023-03-13T22:00:43.879Z | General Question | v2 | what happens when there is no delimiter in the string strtok is called on | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-04T20:40:57.367Z | General Question | v1 | How do you open a file | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-04T21:25:10.900Z | General Question | v1 | what are the all the ways to compare strings | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-04T22:57:39.775Z | General Question | v1 | generate a detailed documentation of `strcmp` with usage examples and explanations | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:21:27.238Z | General Question | v1 | how do you add elements to a char array | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:22:06.154Z | General Question | v1 | how do you add elements to an array | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:25:39.215Z | General Question | v1 | what library do you need for len() | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:26:32.144Z | General Question | v1 | how do you calculate the length of an array | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:29:02.959Z | General Question | v1 | how do you calculate the number of initialized spots in an array | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:29:26.739Z | General Question | v1 | How do you find the number of elements in an array | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:40:55.193Z | Question from Code | v1 | What are the initial values of the elements in friends | typedef struct user {
char name[MAX_NAME];
char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[MAX_FRIENDS];
struct user *next;
} User; | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:42:41.319Z | Question from Code | v1 | What are the initial values of the elements in friends. | int main() {
char *friends[10];
return 0;
} | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:43:43.876Z | Question from Code | v1 | What are the initial values of the elements in name | typedef struct user {
char name[MAX_NAME];
char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[MAX_FRIENDS];
struct user *next;
} User; | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:48:37.143Z | Question from Code | v1 | What is the initial values of the elements in user1->friends | typedef struct user {
char name[32];
char profile_pic[32]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[10];
struct user *next;
} User;
void create() {
User *user1 = malloc(sizeof(User));
} | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:49:21.843Z | Question from Code | v1 | What are the initial values of the elements of user1->name | typedef struct user {
char name[32];
char profile_pic[32]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[10];
struct user *next;
} User;
void create() {
User *user1 = malloc(sizeof(User));
} | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T01:50:27.725Z | General Question | v1 | Where are structs stored in memory | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T02:01:31.641Z | General Question | v1 | What are the initial values of global data
| null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T02:02:04.966Z | General Question | v1 | What are the initial values of heap data | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T02:03:03.159Z | General Question | v1 | What are the initial values of the data in structs that are defined in header files | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T02:25:37.129Z | General Question | v1 | explain and generate an example of printing the contents of a text file | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-05T02:30:29.947Z | General Question | v1 | generate example code of the fgets function being used on a file | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T13:54:17.937Z | General Question | v1 | What is the keyword that indicates that a word is a legal target but isn't an actual file?
| null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T13:55:12.323Z | Question from Code | v1 | What is rm -f *.o print_ptree? | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:03:10.576Z | Question from Code | v1 | What is print_ptree? | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:05:49.149Z | Question from Code | v1 | is print_ptree a dependency? | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:06:07.573Z | Question from Code | v1 | is print_ptree a variable | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:06:29.869Z | Question from Code | v1 | is print_ptree a variable | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:06:57.519Z | Question from Code | v1 | is print_ptree a recipe | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:07:22.332Z | Question from Code | v1 | is print_ptree a rule | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:07:48.571Z | Question from Code | v1 | is print_ptree a prerequisite | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T14:09:27.487Z | Question from Code | v1 | is print_ptree a rule, target, dependency, variable, recipe, or prerequisite? | FLAGS = -Wall -Werror -std=c99
DEPENDENCIES = ptree.h
all: print_ptree
print_ptree: print_ptree.o ptree.o
gcc ${FLAGS} -o $@ $^
%.o: %.c ${DEPENDENCIES}
gcc ${FLAGS} -c $<
clean:
rm -f *.o print_ptree | null | null |
63c647bb5f004bf4898cf63a | 2023-02-07T19:22:12.489Z | Explain Code | v1 | null | typedef void(*SortFunc_t)(int *, int);
| null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T02:44:16.337Z | General Question | v1 | What is the return value of fgets?
| null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T02:52:08.043Z | General Question | v1 | explain the fread function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T02:54:42.859Z | General Question | v1 | explain the fseek function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T02:56:05.132Z | General Question | v1 | What is the difference between text I/O and binary I/O | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:05:59.621Z | General Question | v1 | What is size_t? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:07:06.934Z | General Question | v1 | What does the od command do? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:07:55.194Z | Explain Code | v1 | null | od --address-radix=x --format=c --format=dC <FILE> | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:09:41.801Z | General Question | v1 | generate a detailed documentation of `--format=dC` with usage examples and explanations | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:10:40.319Z | General Question | v1 | generate a detailed documentation of `--address-radix` with usage examples and explanations | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:13:14.025Z | Explain Code | v1 | null | objdump --wide --sections <FILE> | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:13:54.164Z | General Question | v1 | What are the sections of an object file? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:16:01.504Z | Explain Code | v1 | null | objdump --wide --sections section=.rodata <FILE> | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:17:22.975Z | Explain Code | v1 | null | objdump --full-contents section=.rodata <FILE> | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:19:44.776Z | General Question | v1 | What is the size of a long? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-08T03:35:01.961Z | Explain Code | v1 | null | %#lx | null | null |
63c647bb5f004bf4898cf63a | 2023-02-26T13:36:55.523Z | Question from Code | v1 | What is wrong with this line of code?
| fprintf(fp, 'A'); | null | null |
63c647bb5f004bf4898cf63a | 2023-02-26T14:18:53.473Z | General Question | v1 | what does -lm do?
| null | null | null |
63c647bb5f004bf4898cf63a | 2023-02-26T14:20:15.977Z | Explain Code | v1 | null | gcc -Wall -g -std=gnu99 -o test_load_data dectree.o test_load_data.o -lm | null | null |
63c647bb5f004bf4898cf63a | 2023-02-26T14:20:48.721Z | Question from Code | v1 | What does the -lm do here? | gcc -Wall -g -std=gnu99 -o test_load_data dectree.o test_load_data.o -lm | null | null |
63c647bb5f004bf4898cf63a | 2023-02-26T16:37:33.528Z | General Question | v1 | what does .PHONY do? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-08T04:18:00.425Z | General Question | v1 | Give me an example of a call to the wait function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-08T04:36:32.929Z | General Question | v1 | generate example code for error checking with the fork function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-08T21:21:04.768Z | General Question | v1 | give me an example of a call to the strtok function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-08T23:12:54.174Z | General Question | v1 | give me an example of calling the execvp function | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-08T23:26:57.876Z | General Question | v1 | Is there a function to trim leading whitespace from a string? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-14T13:57:37.974Z | Question from Code | v2 | What does the program print to stderr when it runs without interruption? | int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
x += 2;
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c647bb5f004bf4898cf63a | 2023-03-14T13:58:09.485Z | Question from Code | v2 | What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position A?
| int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
x += 2;
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c647bb5f004bf4898cf63a | 2023-03-14T13:59:34.741Z | Question from Code | v2 | What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
x += 2;
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:00:19.343Z | General Question | v2 | what is a "stubbed main file"? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:14:51.333Z | Explain Code | v2 | null | PORT = 51345 CFLAGS = DPORT = \$(PORT) - g - std = gnu99 - Wall - Werror | null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:19:15.636Z | General Question | v2 | what does $< do in a makefile
| null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:21:06.844Z | General Question | v2 | what do $@ and $^ do in makefiles? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:28:51.941Z | General Question | v2 | How do you use -D in the command line? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-03-31T23:30:06.821Z | Help Write Code | v2 | null | null | null | Give me examples of using -D from the command line. |
63c647bb5f004bf4898cf63a | 2023-04-01T03:27:25.771Z | General Question | v2 | does snprintf add a null terminator? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T15:34:42.389Z | General Question | v2 | Can you have the same #include statement in two files that will be linked? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T19:58:31.734Z | Question from Code | v2 | How do I print cmd_argv[0][5] as a single character instead of an int? | printf("cmd_argv[0][5]: %d\n", cmd_argv[0][5]); | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T19:59:35.923Z | General Question | v2 | what is the digit 108 as a char? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T20:00:14.063Z | General Question | v2 | what is the integer representation of the character
'\r'? | null | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T20:01:08.980Z | Question from Code | v2 | what will strcmp return in this case? | strcmp("Grace\r", "Grace") | null | null |
63c647bb5f004bf4898cf63a | 2023-04-02T21:03:08.246Z | Question from Code | v2 | Why is my code giving me a segmentation fault? | while (i) {
fd_set select_fds = all_fds;
printf("waiting...\n");
if (select(max_fd + 1, &select_fds, NULL, NULL, NULL) == -1) {
perror("server: select");
exit(1);
}
printf("done waiting\n");
if (FD_ISSET(client_fd, &select_fds)) {
if (readn(client_fd, buffer, BUFSIZE - 1) == 0) {
printf("client disconnected\n");
break;
}
char *cmd_argv[INPUT_ARG_MAX_NUM];
int cmd_argc = tokenize(buffer, cmd_argv);
printf("cmd_argc: %d, cmd_argv[0]: %s | cmd_argv[1]: %s\n", cmd_argc, cmd_argv[0], cmd_argv[1]);
fflush(stdout);
printf("user: %s\n", user_list->name);
fflush(stdout);
if (cmd_argc > 0 && process_args(cmd_argc, cmd_argv, &user_list, user_name) == -1) {
break;
}
printf("> ");
}
i = 0;
}
return 0;
} | null | null |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.