Re: compiler error question

Ted Szoczei <[email protected]>
Newsgroups gmane.comp.windows.off-topic
Organization Nimajin
Message-ID <[email protected]>
Hi John,

- if(str[X] == ' \\ ' ) //error is here

+ if(str[X] == '\\' )

Single quote delimits a character, but you have three characters in there.

Maybe the compiler is changing it to a string?

Best regards,

Ted

Monday, May 31, 2010, 1:17:45 PM, you wrote:

Hi All,

I need a function that adds an extra backslash to a file path that is returned by another function. I couldn't find any examples anywhere so I wrote one of my own and when I compile the code I get the following error:

error C2666: '[]' : 2 overloads have similar conversions

what does that mean? I wrote the original code on another dev machine and it works perfectly but when I copy the code to another machine, the one I'm sending this email from in fact, I get that error. the code I am using is written below.

int main(int argc, char *argv[])

{

char str[] = "C:\\This\\is\\a\\test.exe"; //test path functional verification

//cycle through the string and add an extra backslash character whereever a single backslash is found

for(unsigned int X = 0; X < strlen(str); X++)

{

if(str[X] == ' \\ ' ) //error is here

{

printf("\\");

}

printf("%c", str[X]); //and here

}

printf("\n");

//other code

return(0);

}

__._,_.___

Reply to sender |
Reply to group |
Reply via web post |
Start a New Topic

Messages in this topic
(8)

Recent Activity:

Visit Your Group

MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

----------

Get great advice about dogs and cats. Visit the Dog & Cat Answers Center.

----------

Hobbies & Activities Zone: Find others who share your passions! Explore new interests.

http://groups.yahoo.com/;_ylc=X3oDMTJkMmoxazR0BF9TAzk3NDc2NTkwBGdycElkAzM3MDE1MjQEZ3Jwc3BJZAMxNzA1MDA2NjY5BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjc1MzUxMzU0

Switch to: Text-Only , Daily Digest • Unsubscribe • Terms of Use

.

__,_._,___
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.