[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / w / wg] [i / ic] [r9k] [cm / hm / y] [3 / adv / an / cgl / ck / co / diy / fa / fit / hc / int / jp / lit / mlp / mu / n / po / pol / sci / soc / sp / tg / toy / trv / tv / vp / wsg / x] [rs] [status / q / @] [Settings] [Home]
Board
SettingsHome
4chan
/g/ - Technology
Text Boards: /tech/ & /prog/

J-List

Posting mode: Reply
Name
E-mail
Subject
Comment
Verification
reCAPTCHA challenge image
Get a new challenge Get an audio challengeGet a visual challenge Help
4chan Pass users can bypass this CAPTCHA. [Learn More]
File
Password (Password used for deletion)
  • Supported file types are: GIF, JPG, PNG
  • Maximum file size allowed is 3072 KB.
  • Images greater than 250x250 pixels will be thumbnailed.
  • Read the rules and FAQ before posting.
  • Japanese このサイトについて - 翻訳
  • You may highlight syntax and preserve whitespace by using [code] tags.

J-List

Toggle
Happy Pi Day!

Hope you enjoy it with your qt 3.14 gf!!!!

File: 1363294460718.gif-(35 KB, 1280x1024, 1351518967058.gif)
35 KB
35 KB GIF
>C++
I want to copy a file in /Program Files.
#include <windows.h>

using namespace std;

int main()
{
system("copy C:\\Users\\%username%\\Desktop\\test.txt C:\\Program Filestest.txt");
return 0;
}

It doesn't work.

Halp /g/
>>
Fail

#include <windows.h>

using namespace std;

int main()
{
system("copy C:\\Users\\%username%\\Desktop\\test.txt C:\\Program Files\\test.txt");
return 0;
}
>>
>Windows
lel
>>
>>32265550 (OP)
C:\\Program Filestest.txt

There's no backslash after "Files"

Also, it might need to run as Admin
>>
File: 1363294635635.jpg-(24 KB, 300x225, disgusting.jpg)
24 KB
24 KB JPG
>using backslashes for directories
>>
>>32265573
Also, probably needs to be

system("copy C:\\Users\\%username%\\Desktop\\test.txt  \"C:\\Program Files\\test.txt\"");
>>
>>32265602

It doesn't work.

Error :
Command's syntax is invalid


%Program Files% ?
>>
File: 1363294874973.png-(132 KB, 1920x1200, 1359055729557.png)
132 KB
132 KB PNG
>>32265665

mfw guy it works

Thanks !
>>
>>32265573
>>32265665
Does it not need to be Program\ Files or am I mixing up Linux and Windows?
>>
>using system()
Copy the damn file and stop using C++ as a fucking shell scripting language.
>>
>>32265550 (OP)
Don't use the system function.

In this case, don't even use C++, just write a shell script.


J-List

Delete Post [File Only] Password
Style
[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / w / wg] [i / ic] [r9k] [cm / hm / y] [3 / adv / an / cgl / ck / co / diy / fa / fit / hc / int / jp / lit / mlp / mu / n / po / pol / sci / soc / sp / tg / toy / trv / tv / vp / wsg / x] [rs] [status / q / @] [Settings] [Home]
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

- futaba + yotsuba -
All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.