CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: String problem

  1. #1
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    String problem

    Hi,
    Can anyone explain why is this error?


  2. #2
    Join Date
    Dec 2012
    Posts
    3

    Re: String problem

    you can write
    C:/users/MilosS/Desktop/seba/playboy
    don't use "\" always use "/" it will work
    thx

  3. #3
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: String problem

    aha, now it works. Thanx.

  4. #4
    Join Date
    Dec 2012
    Posts
    3

    Thumbs up Re: String problem


  5. #5
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: String problem

    Name:  Untitled.png
Views: 828
Size:  18.7 KBName:  Untitled1.png
Views: 825
Size:  13.7 KB

    I get this 2 warnings when i run Eclipse. Why are they popping up and what can i do to fix it?

  6. #6
    Join Date
    Dec 2012
    Posts
    3

    Re: String problem

    try this is official website

    http://wiki.eclipse.org/EGit/User_Guide

    you will get complete guide here simply follow the steps.. hope it will work.
    thx

  7. #7
    Join Date
    Dec 2012
    Location
    Danang, Viet Nam
    Posts
    9

    Re: String problem

    Quote Originally Posted by flex567 View Post
    Hi,
    Can anyone explain why is this error?

    Another way is using like this : "C:\\Users\\MilosS"

  8. #8
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: String problem

    C:/users/MilosS/Desktop/seba/playboy
    don't use "\" always use "/" it will work
    This is not quite true. In the case of a windows file path using '/' instead of '\' will work in other situations you may well need to use '\'.
    The problem is as follows: in Java the "\" char is used to escape other characters to provide special meaning ie \t gives a tab char, \n a newline etc. So if you want to put an actual "\" in a string you have a to add a "\" to the front of it to tell the compiler to embed a "\" rather than treat it as an escape sequence. So your string would need to be: "C:\\users\\MilosS\\Desktop\\seba\\playboy".
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  9. #9
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: String problem

    Code:
    		  for (int i = 0; i <= c_path_name.length-1; i++) {
    			if(c_path_name[i] == '\')	{
    					c_path_name[i] = '/';
    		  								}	
    		  												}
    Can someone explain to me why this won't compile?
    And what should I change in this code so it would compile.
    Last edited by flex567; January 3rd, 2013 at 09:45 AM.

  10. #10
    Join Date
    May 2009
    Location
    Lincs, UK
    Posts
    298

    Re: String problem

    keang posted the answer already (see post #8)

  11. #11
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: String problem

    solved that problem with '\\'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured