python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Strtok returns the same word after being called using token = (NULL, "\n")
I am trying to tokenize a line read from a file but strtok() always returns the first word. Here is the code I have currently:
fgets(line, 40, fp);
token = strtok(line, " ");
b[i...
Bug
Votes: 0
Answers: 0
How do I read a single letter from a file when the letter has a space on either side? (C)
I'm currently working on an assignment in my Intro to C class. The assignment has us using fgets to read a single line from a file, then strcpy and strtok to take individual elements from that line an...
JakeFist26
Votes: 0
Answers: 0
Strtok isn't returning as expected, am I using it wrong?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// fiter string to the first |
char* filterstringfirst(char* command, int i){
char *tok = command;
int x = 0;
...
DynamicApproach
Votes: 0
Answers: 2