"If your console application returns straight away, then you wont see anything because the program has executed, thus the window has closed. Thats why you only see it working fine in cmd."
Actually its not supposed to do anything,it just operates with files so i dont need any output to the screen (except for debugging things).
And that /run cmd /k "path" didn't seem to help.Well,actually there is a strange problem with my application..When i modify it so it reads from the file and outputs its content to the screen,the value is correct!When i look into the .txt file with notepad though,i see that nothing has changed.I thought that my program may have created an ADS (Alternative Data Stream) file which is completely invisible to cmd and windows,but after searching with LADS (a program to locate these files),i found nothing.
Anyway people,thx for your help,i found another way to do this.