Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 816 results for
strchr
- Page 1
strchr, strcmp, memset
Programming
Software Development
7 Years Ago
by SlimmC88
… strcopy but Im having trouble finding how to code the
strchr
, strcmp, and memset functions. Unfortunately I am new to MIPS…
Re: strchr, strcmp, memset
Programming
Software Development
7 Years Ago
by rproffitt
… them on and test. https://www.google.com/search?q=
strchr
%2C+strcmp%2C+memset+for+MIPS finds them. Example? Read…
program closes when using strchr with fgets
Programming
Software Development
14 Years Ago
by iwanttolearnc
… reads the data enclosed by %. im guessing its a
strchr
problem. please help [CODE]#include <stdio.h>… sizeof line, file ) != NULL ) /* read a line */ { start =
strchr
(line , '$'); end =
strchr
(start + 1 , '$'); if (start != NULL && end != NULL…
Re: How do I use strchr?
Programming
Software Development
19 Years Ago
by M.Rodz
… C++. I have doubts :o about how to use the
strchr
function. Can somebody give me some hints? :?: > Thanks. This…;<vowel1<<'\n'; cout<< "
strchr
="<<
strchr
( word, vowel1) <<endl<<endl;
Re: program closes when using strchr with fgets
Programming
Software Development
14 Years Ago
by Ancient Dragon
when line 25 returns NULL then line 26 is going to cause a lot of grief. You need an if statement between those two lines. [code] if( (start =
strchr
(line,'$')) != NULL) { // blabla } [/code]
Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by SCass2010
… positions of the *'s with const char* msgStart =
strchr
(msg, '*'); const char* nameEnd =
strchr
(msgStart+1, '*'); then assign const char* name = msgStart…
Why is this strchr program a segfault?
Programming
Software Development
12 Years Ago
by HelloJarvis
Hey guys, I'm working with `
strchr
` and, for some reason, am getting a segfault. My program … alphabet, update // score based on corresponding letter score char* c =
strchr
(alphabet, word[i]); while (c != NULL) { int index = c - word…
Re: Why is this strchr program a segfault?
Programming
Software Development
12 Years Ago
by dx9_programmer
…() or toupper() on word[i] when passing it to the
strchr
() function. good char c = 'y'; if (c == 'y' || c == 'Y… the difference in bytes. So, given a pointer `char* p =
strchr
(alphabet, 'D')`, then assume letter A is at address 200…
Re: How do I use strchr?
Programming
Software Development
19 Years Ago
by vegaseat
…;\"" << endl; // find the first occurance pch =
strchr
( str1, 's' ); // then search further while( pch != NULL ) { cout <… index " << (pch - str1) << endl; pch =
strchr
( pch + 1, 's' ); } cin.get(); // wait return 0; } [/php] In…
Re: Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by Banfa
Do you check your return value from
strchr
for NULL? I ask because you search for '*' but you …
How do I use strchr?
Programming
Software Development
19 Years Ago
by M.Rodz
[COLOR=Blue][FONT=Arial Narrow]Hi. I am a begginer :cheesy: on the programming area and I am currently taking a course on C++. I have doubts :o about how to use the
strchr
function. Can somebody give me some hints? :?: Thanks.[/FONT][/COLOR]
Problems working with strchr
Programming
Software Development
19 Years Ago
by M.Rodz
…<=4; i++) { strcpy (pch,palabra); while( pch != NULL ) { pch=
strchr
(pch, vocales[i]); if( pch!=NULL ) { count++; } } } cout<<…
Re: Problems working with strchr
Programming
Software Development
19 Years Ago
by M.Rodz
…<=4; i++) { strcpy (pch,palabra); while( pch != NULL ) { pch=
strchr
(pch, vocales[i]); if( pch!=NULL ) { count++; } } } cout<<…
Re: program closes when using strchr with fgets
Programming
Software Development
14 Years Ago
by iwanttolearnc
thanks!
Re: Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by Ancient Dragon
you have to allocate memory (see malloc or new) for nameBuffere before you can copy something to it. Also, I don't see any \* in the example you posted -- maybe because DaniWeb editor deleted them. If you want a star then you will have to escape it, such as \\*
Re: Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by SCass2010
Yeah just realised now that all the '*' had been removed from the example - > \*Stephen\*10:11:00\*02/07/2012\*Hi there Ah right, I thought you could just assign the buffer to hold the result to 0, since it was going to be pointing to an already existing char*... as you can tell, I'm still learning C/C++ lol :)
Re: Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by Lucaci Andrew
Here's a way of doing it using string, and C++ items: #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; int main(){ string str="HEllo*world*hello.", split; vector<string> all; istringstream token(str); while (…
Re: Split char* using pointers and strchr
Programming
Software Development
12 Years Ago
by L7Sqr
Well, you *can* store pointers to the memory locations of the '\*'s in your code but in order for them to work with other string functions and as you might want them to behave you have to terminate the string with a null character `\0` (this is how `strtok` works). This might be a solution for you but I doubt it. I'd suggest using the facilities …
Re: Why is this strchr program a segfault?
Programming
Software Development
12 Years Ago
by HelloJarvis
Congratulations! You're no longer a DaniWeb newbie.<br /> <br /> Your DaniWeb account has just been upgraded from newbie status and now you have the ability to take advantage of everything the community has to offer.<br /> <br /> You can now enjoy an advertisement-free DaniWeb by ticking the checkbox to Disable Ads in your …
Re: Why is this strchr program a segfault?
Programming
Software Development
12 Years Ago
by deceptikon
dx9_programmer's answer is good, but I'd like to add just a couple of things. First, don't call strlen() in the condition of a loop because it's inherently inefficient. strlen() is a function that itself contains a loop, so when you say this: for (int i = 0; i < strlen(word); i++) { ... } It's roughly equivalent to this: …
Re: Why is this strchr program a segfault?
Programming
Software Development
12 Years Ago
by HelloJarvis
Great, thanks! A quick fix to the while loop got it right back up and running! Also, about the toupper and such, I omitted that code, so not to worry, it is being converted to uppercase.
Re: Problems working with strchr
Programming
Software Development
19 Years Ago
by Dogtree
You've pretty much checked off everything on the "don't do" list of basic C. Maybe you should start using the standard C++ classes instead of fumbling around with the low level arrays and pointers of the C subset of C++. It's easier to get right if you don't have years of experience with the low level stuff: [code] #include <…
Re: Problems working with strchr
Programming
Software Development
19 Years Ago
by Dogtree
Viva la std::string!
C Radio Button Issue
Programming
Software Development
16 Years Ago
by BruenorBH
…(Hour); if (
strchr
(ConvertTime, 'A') == NULL ||
strchr
(ConvertTime, 'P') == NULL ||
strchr
(ConvertTime, 'a') == NULL ||
strchr
(ConvertTime, 'p')…= intHour + 12; } } else if (
strchr
(AMPM, 'A') != NULL &&
strchr
(AMPM, 'a') != NULL) { if (…
Re: C Radio Button Issue
Programming
Software Development
16 Years Ago
by nucleon
… atoi(Hour); if (
strchr
(ConvertTime, 'A') == NULL ||
strchr
(ConvertTime, 'P') == NULL ||
strchr
(ConvertTime, 'a') == NULL ||
strchr
(ConvertTime, 'p') … = intHour + 12; } } else if (
strchr
(AMPM, 'A') != NULL &&
strchr
(AMPM, 'a') != NULL) { if (intHour…
A project making use of FILE and file functions fopen,fgets and fclose
Programming
Software Development
18 Years Ago
by Bobbiegirl
… "%s", buf); p = buf; c =
strchr
(p,':'); *c = '\0'; strcpy(s -> name,… p); p= c+1; c =
strchr
(p,':'); *c = '\0'; strcpy(s -> curr,…; gradyr = atoi( p); p= c+1; c =
strchr
(p,':'); *c = '\0'; s->ssn = atoi( p…
Re: error C2375: 'my_strdup' : redefinition; different linkage
Programming
Software Development
18 Years Ago
by arunprabhakar
…"--" and terminate */ } else return EOF; } c = *rem; q =
strchr
(optstring, c); if (q && c != ':') { /* matched */ needarg =…("_strdup") #endif _CRTIMP __checkReturn _CONST_RETURN char * __cdecl
strchr
(__in_z const char * _Str, __in int _Val); _CRTIMP __checkReturn …
Bool problem
Programming
Software Development
16 Years Ago
by FTProtocol
…quot;%s = %d", szBuffer, szCalc.SetDiv(atol(szBuffer2), atol((
strchr
(szBuffer, ' / ')+3)))); SetWindowText(hwScreen, szFinalBuffer); } else if(…"%s = %d", szBuffer, szCalc.SetMul(atol(szBuffer2), atol((
strchr
(szBuffer, ' * ')+3)))); SetWindowText(hwScreen, szFinalBuffer); } break; } …
Re: Index of a character array
Programming
Software Development
16 Years Ago
by StuXYZ
… same code. displayCharIndex is wrong because the ine char*
strchr
.... is a function declaration (function returning char*) you…[], int size, char ch) { char*
strchr
; //search code //make
strchr
point to the first instance of ch in …strArray // ... return
strchr
-strArray; [/code] I am guessing this is an …
Error C2137: Empty Character Constant?
Programming
Software Development
15 Years Ago
by Trekforever
…* ptr; // Search for 't' and delete it ptr =
strchr
(msg, 't'); while (ptr != NULL) { cerr <…ptr-msg << endl; *ptr = ''; ptr=
strchr
(ptr+1, 't'); } // Search for 'T' and…lt; ptr-msg << endl; *ptr = ''; ptr=
strchr
(ptr+1, 'T'); } } int main() { char msg[…
1
2
3
14
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC