Hi I have a piece of code that's supposed to find and change all instances of words in a sentence. Here's what it pretty much looks like:
while(replace = strstr (p, from)){
while(*to){...
Type: Posts; User: rkrajnov
Hi I have a piece of code that's supposed to find and change all instances of words in a sentence. Here's what it pretty much looks like:
while(replace = strstr (p, from)){
while(*to){...
Good call. that probably was whats wrong. not gonna bother messing with it now though cause it works how I have it.
Figured it out!
needed to be read in like this
%s %s %[^\n]
Thanks for the help guys. you definitely got me on the right track.
unfortunately I tried that and it results in a segmentation fault as well.
Here's the main relevant method. It gets a string response through a program given to us. The sendCommand method outputs into response (so response has right output no questions asked). Then I...
What do you mean by stripping line feeds.... there definitely is a trailing line feed. Take a look at my initial post and you can see what the input is (note it could be 3, 4, 5+ lines as well).
No, it definitely is valid right there. It's defined just before this segment of code all in the very same method. I'm 99% sure the problem is in something I wrote out 2 posts ago. I just don't know...
Ok I will check it out and that's not the case. Response is defined in the rest of my code. I've tested it to make sure response is ok. I can print off response fine with no segmentation error and...
Here's what I just tried, but its giving me a segmentation fault. i have a feeling it might have to do with my misunderstanding of what %[^\n] is doing
(response is the string)
char str [100];...
That makes sense, but what exactly is the %[^\n] doing?
Ok so I've got a kind of weird question
I need to take output such as:
"12 Spiderman message goes here\n
13 Superman message goes here"
And reformat it like
12: Spiderman - message goes here...
Ok so I'm making this program and its pretty much just converting from one base number to another (i.e. base 16 to base 10[normal]). Anyhow, that's not really important, what is is that my program is...