File open problem - VxWorks

This is a discussion on File open problem - VxWorks ; I am using VxSim on Windows XP. I have included "INCLUDE_ANSI_STDIO" in the VxWorks. I like to open an I/O file in "append" mode. My code is as below: /******************************** #include #include int Vtest (void) { FILE* myFile; myFile = ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: File open problem

  1. File open problem

    I am using VxSim on Windows XP.
    I have included "INCLUDE_ANSI_STDIO" in the VxWorks.
    I like to open an I/O file in "append" mode.

    My code is as below:
    /********************************
    #include
    #include

    int Vtest (void)
    {
    FILE* myFile;
    myFile = fopen("/tgtsvr/test", "a");
    if (NULL==myFile)
    {
    printf("Couldn't open the file \n");
    return 1;
    }
    fclose (myFile);

    return 1;

    }/*Vtest()*/
    ***********************************/

    When I load and run this code, I can't successfully create the file
    "/tgtsvr/test". I am not sure, whether I could create a file under
    "/tgtsvr", which is existed in the target server (VxSim), I could see
    that path by typing "devs()" command on the VxWorks shell. Any help in
    this regard.


  2. Re: File open problem

    Did you face the same problem with

    open("/tgtsvr/test", O_CREAT | O_RDWR, 0666);

    ?


    akarui.tomodachi@gmail.com wrote:
    > I am using VxSim on Windows XP.
    > I have included "INCLUDE_ANSI_STDIO" in the VxWorks.
    > I like to open an I/O file in "append" mode.
    >
    > My code is as below:
    > /********************************
    > #include
    > #include
    >
    > int Vtest (void)
    > {
    > FILE* myFile;
    > myFile = fopen("/tgtsvr/test", "a");
    > if (NULL==myFile)
    > {
    > printf("Couldn't open the file \n");
    > return 1;
    > }
    > fclose (myFile);
    >
    > return 1;
    >
    > }/*Vtest()*/
    > ***********************************/
    >
    > When I load and run this code, I can't successfully create the file
    > "/tgtsvr/test". I am not sure, whether I could create a file under
    > "/tgtsvr", which is existed in the target server (VxSim), I could see
    > that path by typing "devs()" command on the VxWorks shell. Any help in
    > this regard.



  3. Re: File open problem

    hi tomoda,
    I think the pathname mentioned in the fopen is
    wrong.Typically the pathname should look like this to the best of my
    memory,I cannot try it out now as I work on linux .
    host:drive:/dir/subdir/file

    Eg:
    host:c:/autoexec.bat

    Hope that was useful.

    -kaushal.


+ Reply to Thread