I am writing a program to open a folder which is like
it should take path "//C$/ettings/Tj/Dp"Code:#include <stdlib.h> int main() { char STRG[80]=""; char STRG1[80]="explorer //C$/ettings/Tj/Dp"; system(STRG1); }
but it is taking "/C$/ettings j/Dp"
I know that compiler do not read \t,\\ as a normal character but then whats the solution?
Last edited by Jaan; 08-09-2009 at 02:22 PM. Reason: Use code tags when you are posting your codes!
I guess you would have to escape your path:
\\\\C$\\Settings\\Tj\\Dp
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
Yeah, explorer takes paths with backslashes, which are used for escape characters in C and C++, so you'll have to write \\ for one \.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
No, it's Windows' fault. Everyone else (i.e. MacOS, Linux, UNIX, etc.) uses the forward slash. I would suggest using MAX_PATH as the buffer size, by the way. Less chance of buffer overruns. Or better yet, use a C++ string and then just call
Code:std::string path = "explorer C:\\really\\long\\path"; system(path.c_str());
sudo rm -rf /
You just need to understand it all for Windows. It is the opposite for all other OSes.
Exactly. Welcome to CodeCall, mhaqs.
sudo rm -rf /
lol yeah it's weird really..
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I know! Windows is written in C...didn't anyone notice that it's incredibly annoying to write \\\\.\\A\\: every time you want to open a directory for reading? One of the last things I wrote for Windows was this tool that collected partition information out of every valid drive. That was a pain.
Last edited by dargueta; 08-14-2009 at 04:59 AM. Reason: Forgot to make a snide comment
sudo rm -rf /
Perhaps Microsoft developers are sadomasochists..
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks