Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nodger

How do I refer to a "

This topic is 5388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My program keeps crashing because I am searching for the " character in a string and I dont know how to reference it properly. Ive tried ''"'',''""'',''\"'' all to no avail. google game me no search results either. I probably should stop, My doctor says I have the wrists of an 80-year old

Share this post


Link to post
Share on other sites
Advertisement
I am not exactly sure *how* you are looking for the " character but this is a quick example.


int main()
{
char buffer[100];
sprintf(buffer, "This \"string\" has several \"''s in it\n");


for ( int x = 0; x < strlen(buffer); x++ )
if ( buffer[x] == ''"
'' )
printf("Found \" at position %d\n", x );

return 0;
}


-------
Andrew
PlaneShift - A MMORPG in development.

Share this post


Link to post
Share on other sites
Here's a similar question, but more complicated. Is there any way to pass the '"' character as part of a string? For example:

char string[] = "Is there a way to do "this"";

Obviously that won't work as it is, and doing something like '"'this'"' doesn't work either, also for obvious reasons. In the circumstance I've needed it, I've resorted to setting that character seperately after initialisation. I was wondering if there's a way to pass it inside a string.



[edited by - Nemesis2k2 on September 23, 2003 7:32:30 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
im trying to figure out how some who codes doesnt know this
but its been used in the posts above like 6 times

"this is a \"string\" with double quotes in it"

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!