?
Solved

Need to write a file to a certain folder

Posted on 2006-06-05
7
Medium Priority
?
604 Views
Last Modified: 2012-05-05
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
Comment
Question by:Ramy_atef
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 16835121
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
 
LVL 7

Author Comment

by:Ramy_atef
ID: 16835419
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
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 16835554
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
 
LVL 3

Expert Comment

by:srinims
ID: 16839718
>>> it gives me a can't open stido.h

use stdio.h instead of stido.h

0
 
LVL 3

Expert Comment

by:srinims
ID: 16839726
for the above code given by jkr, don't use turboc. it won't compile . pls use microsoft compiler.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question