19 Topics

Member Avatar for
Member Avatar for zdreggs

Hello, I am trying to understand how to use C-style strings in C++. My goal is to store a C-style strings into a string type array. If I pass "This is a test" into word_token, it displays: This Is A test So from here I believe my setup is almost …

Member Avatar for rproffitt
0
256
Member Avatar for Pyler

So I'm trying to remove 2 brackets from lines I'm reading from a file. For some reason when I run my program the characters in between the delimeters is removed. for example `greetings pe()ple` would end up as `greetings pe` I'm using a char array of delimiters. `char delimiters[] = …

Member Avatar for Pyler
0
199
Member Avatar for Builder_1

the folllowing code i have made but its not catering for the vowels coming together...what should i do in this code to accurately count the number of vowels and count the remining char left in string without vowels as after tokenization only the first token remains in the char array/string …

Member Avatar for Builder_1
0
553
Member Avatar for smith32

Hi, Here is the File content. I want to use strtok to separate each. but the problem is if i use `strtok(string, "\",");`, the zip code (19428) of the detail is miss place and take State (PA) for the first record Because of "," in State. Although the second one …

Member Avatar for smith32
0
988
Member Avatar for aldrin_ison1

Hi! I'm new to C and I'm having some problems in my program. It opens a .txt file then copies this to another .txt file but replaces a certain word with another word. It uses command line arguments. Example: //inside text.txt love is patient love is kind ... ./change love …

Member Avatar for histrungalot
0
450
Member Avatar for engineerchica

Hey everyone, I am working on a function that reads a text file (portion below) of data points arranged in two columns and stores the numbers only in an array of signal[2500][2]. The problem is, I need to do some search and replace on [I]some[/I] of the data points. Some …

Member Avatar for WaltP
0
218
Member Avatar for shaunchu

So, I'm doing a test of strtok and my csv reader to fill an array of structs. Each line in the csv has a bunch of country information, and I'm only pulling the 2nd, 3rd, 8th, and 9th fields in each line to make the structs. My biggest problem at …

Member Avatar for shaunchu
0
172
Member Avatar for Lillylionhert
0
114
Member Avatar for Lillylionhert

I am working on a Priority Based Scheduler which reads the process in from a file. I have it reading from file and printing to the screen. I'm trying to use strtok to tokenize a line from the process test file and store it in three different arrays. The layout …

Member Avatar for Lillylionhert
0
4K
Member Avatar for asimnazeer

Hello All i am trying to compile a simple code for the strtok but getting the error as segmentation fault ( core dumped ) .. any help would be appreciated. [CODE] #include <stdio.h> #include <netinet/in.h> #include <stdlib.h> #include <string.h> main() { char *test="asim.nazeer.helo.me"; char *rsl=strtok(test,"."); //while(1) //{ printf("%s",rsl); //} } …

Member Avatar for asimnazeer
0
458
Member Avatar for mkab

Hello everyone. I have a problem using strtok in C. I get a user input from the command line and I want to tokenize it with pipe ("|") as the delimeter and put the result in a double pointer variable. Here's my code: [CODE]char** argv; char *token; token = strtok(userInput, …

Member Avatar for mkab
0
2K
Member Avatar for Ascar

Hi, I need help with this, I'm reading a txt file that has this format: 10,4,12,6,18,24,7,8,15,14,25,2 So far, I read the file using fopen ().Also, I used strtok () to split the string into tokens, but i don't know how store the tokens into an array. any ideas? thanks [CODE] …

Member Avatar for MonsieurPointer
0
634
Member Avatar for gkaykck

Hi I am trying to make my homework about a command line calculator, and i am trying to divide the entered string into small parts and i am trying to use strtok for this. [CODE] #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> struct var { char name[10]; double value; …

Member Avatar for gkaykck
0
589
Member Avatar for xenanovich

hi, this is something i keep running into. for example, in the following example of strtok, i'm splitting a given string on a space(" ") delimiter: [code] #include<stdio.h> #include<string.h> int main() { char str[]="1234563 34 7898"; char delim[]=" "; char* result=NULL; char new[15][3]; int i=0; int j=0; bzero(new, sizeof new); …

Member Avatar for xenanovich
0
177
Member Avatar for P3druh77

Hi... i have a little problem on my code... HI open a txt that have this: LEI;7671;Maria Albertina da silva;xxxx@gmail.com; 9;8;12;9;12;11;6;15;7;11; LTCGM;6567;Artur Pereira Ribeiro;fdsdfsd@gmail.com; 6;13;14;12;11;16;14; LEI;7701;Ana Maria Carvalho;asasssas@gmail.com; 8;13;11;7;14;12;11;16;14; -------------------------------------------------------------------------------- LEI, LTCGM are the college; 7671, 6567, 7701 is student number; Maria, Artur e Ana are the students name; [email]xxxx@gmail.com[/email], …

Member Avatar for Aia
0
238
Member Avatar for livestrong2431

Hello. I'm just starting out in C++ and am trying to figure out how to split a users string input into individual words and then put each word into a slot in an array. I think it's going rather well, but I'm running into some problems, and it would be …

Member Avatar for livestrong2431
0
769
Member Avatar for ContactaCall

how would this be done [CODE]int main(void) { char string[]="231 number 73 word 1 2"; char *ele; ele=strtok(string," "); while (ele != NULL) { if (*ele == '0' || *ele == '1' || *ele == '2' || *ele == '3' || *ele == '4' || *ele == '5' || *ele …

Member Avatar for ContactaCall
0
239
Member Avatar for ContactaCall

So I'm using Mysql to make a text-to-speech engine. Basically any given phrase by the database is returned to my script, which has to say every word and number, if any, by way of voice . For the voices I'm using Asterisk, but that's another problem of my own lol …

Member Avatar for Dave Sinkula
0
398
Member Avatar for AdRock

I have got an example for cplusplus.com for converting a string into a char array so i can split in into tokens and adds to a vector and it works fine in the main method but if i try and create a separate function and pass a string as a …

Member Avatar for iamthwee
0
740

The End.