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

Thread: String problem

Hybrid View

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

    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
    201

    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
    201

    Re: String problem

    Name:  Untitled.png
Views: 78
Size:  18.7 KBName:  Untitled1.png
Views: 74
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,474

    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
    201

    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
    Surrey, UK
    Posts
    285

    Re: String problem

    keang posted the answer already (see post #8)

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

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center