Need to write a file to a certain folder

Posted on 2006-06-05
Last Modified: 2012-05-05
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

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/
Question by:Ramy_atef
    LVL 86

    Expert Comment

    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"));


    p = fopen(myFlashProject,"w");



    int main () {


    return 0;

    LVL 7

    Author Comment

    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
    LVL 86

    Accepted Solution

    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 ( or any other free C compiler
    LVL 3

    Expert Comment

    >>> it gives me a can't open stido.h

    use stdio.h instead of stido.h

    LVL 3

    Expert Comment

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

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
    Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now