Re: compiler error question
Stoyan Damov <[email protected]>
| Newsgroups | gmane.comp.windows.off-topic |
|---|---|
| Message-ID | <[email protected]> |
Oh, and btw, you have to add 4 backslashesh to print 2 :) On Mon, May 31, 2010 at 9:31 PM, Stoyan Damov <[email protected]>wrote: > Which compiler? > Builds just fine under VS 2008. > > Cheers > > > On Mon, May 31, 2010 at 8:17 PM, John Smith <[email protected]> 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); >> } >> >> >> > >