• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 616
  • Last Modified:

Need to write a file to a certain folder

Hi
Need the code and the exe file (and any other needed files)  of a small program that will run from a CD ,
it'll get the CD drive name and write it in a file named myFlashProject.cfg and put it in

again:
1) write a filne named  "myFlashProject.cfg"
2) which contains
  <drive letter>:\
   where <drive letter> is the drive letter of the current CD-ROM for this installer, e.g. "F:\"
3) into the directory
<root>\Documents and Settings\<UserName>\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust/
0
Ramy_atef
Asked:
Ramy_atef
  • 2
  • 2
1 Solution
 
jkrCommented:
Not a big deal, e.g.

#include <windows.h>
#include <shlwapi.h>
#include <stdio.h>

void myFlashProjectCfgCreate() {

FILE* p
char myFlashProject[MAX_PATH];
char acCurDrive[MAX_PATH];

wsprintf(myFlashProject,"\"%s\\Application Data\\Macromedia\\Flash Player\\#Security\\FlashPlayerTrust\\myFlashProject.cfg\"",getenv("USERPROFILE"));

GetModuleFileName(NULL,acCurDrive,MAX_PATH);
PathStripToRoot(acCurDrive);

p = fopen(myFlashProject,"w");

fputs(acCurDrive,p);

fclose(p);
}

int main () {

myFlashProjectCfgCreate();

return 0;

}
0
 
Ramy_atefAuthor Commented:
excuse me .. last time i used C about 6 years ago.. so my questions will be silly

I'm using the old Turbo C, and when trying to combile , it gives me a can't open stido.h , the file is there in the include folder, I even copied it with the .c file in the same folder
also there are another error : Function should return a value in line 108

there were an error in the if statment but i fixed it  but what about the above
0
 
jkrCommented:
Forget about Turbo C, you can't really use that for applications on an up-to-date Windows. I'd rather suggest to either get MinGW (www.mingw.org) or any other free C compiler
0
 
srinimsCommented:
>>> it gives me a can't open stido.h

use stdio.h instead of stido.h

0
 
srinimsCommented:
for the above code given by jkr, don't use turboc. it won't compile . pls use microsoft compiler.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Firewall Management 201 with Professor Wool

In this whiteboard video, Professor Wool highlights the challenges, benefits and trade-offs of utilizing zero-touch automation for security policy change management. Watch and Learn!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now