954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ofstream and movefile

if you use movefile and ofstream the ofstream file won't be made.. :s any way to solve this?

qeinar
Newbie Poster
8 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

So you mean this function ?

>>s any way to solve this?
Yes, fix the bug in your program.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

movefile is usualy the movefile function..

qeinar
Newbie Poster
8 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

what operating system and compiler are you using? Do you mean the version in my last link? If not, then provide link to it because there is no standard C or C++ library function.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

i use visual express c++. gonna post the part of my code..

#define KEY "C:\\Users\\qeinar\\hmm.exe"

int main(int argc, char **argv)
{
MoveFile(argv[0], KEY);


ofstream fout;
fout.open("hmmgetasynckey.txt");

}

(ofc theres more there but it's alot so.. :P but nothing that would screw over these comands.. since i've tested it elsewhere withotu the rest of the code.. just something abit more simple.. ^^)

qeinar
Newbie Poster
8 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

>>MoveFile(argv[0], KEY);
That will always fail because you can not move a currently running program, and argv[0] contains the name of the program you are writing.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

close/deleate the thread please.. i solved it by changing the fout.open loc.. o.o' stupid me..

qeinar
Newbie Poster
8 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 
>>MoveFile(argv[0], KEY); That will always fail because you can not move a currently running program, and argv[0] contains the name of the program you are writing.

well wierd 'cus it seems i can.. ^^

qeinar
Newbie Poster
8 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You