how to open a file on a perticular path - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how to open a file on a perticular path

d_deepakd_deepak Posts: 8Member
how to open a file on a perticular path i.e.
if I want to open a file stored on d:deepakdd then how to use fopen()
whether it should be like that
fp=fopen("d:deepakddd1.dat","r+")

plz help

Comments

  • LundinLundin Posts: 3,711Member
    : how to open a file on a perticular path i.e.
    : if I want to open a file stored on d:deepakdd then how to use fopen()
    : whether it should be like that
    : fp=fopen("d:deepakddd1.dat","r+")
    :
    : plz help
    :
    :

    fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
  • bosebonasbosebonas Posts: 87Member
    : : how to open a file on a perticular path i.e.
    : : if I want to open a file stored on d:deepakdd then how to use fopen()
    : : whether it should be like that
    : : fp=fopen("d:deepakddd1.dat","r+")
    : :
    : : plz help
    : :
    : :
    :
    : fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
    :
    If you want to acces a file using the old C way then do it this way :
    FILE *fp;
    fp=fopen ("D:deepakddd1.dat","r+");
    that is it.


  • stephlstephl Posts: 422Member
    : : : how to open a file on a perticular path i.e.
    : : : if I want to open a file stored on d:deepakdd then how to use fopen()
    : : : whether it should be like that
    : : : fp=fopen("d:deepakddd1.dat","r+")
    : : :
    : : : plz help
    : : :
    : : :
    : :
    : : fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
    : :
    : If you want to acces a file using the old C way then do it this way :
    : FILE *fp;
    : fp=fopen ("D:deepakddd1.dat","r+");
    : that is it.
    :
    No, as Lundin wrote it, each '' must be replaced by '\' in the path.
    Steph
  • LundinLundin Posts: 3,711Member
    : : : how to open a file on a perticular path i.e.
    : : : if I want to open a file stored on d:deepakdd then how to use fopen()
    : : : whether it should be like that
    : : : fp=fopen("d:deepakddd1.dat","r+")
    : : :
    : : : plz help
    : : :
    : : :
    : :
    : : fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
    : :
    : If you want to acces a file using the old C way then do it this way :
    : FILE *fp;
    : fp=fopen ("D:deepakddd1.dat","r+");
    : that is it.
    :


    I don't know what "the C old way" is. Follow ANSI C and use the syntax I suggested.

  • bosebonasbosebonas Posts: 87Member
    i just want to say i was mistaken.I agree you did it the right way.
    I am sorry for the misunderstanding.

    : : : : how to open a file on a perticular path i.e.
    : : : : if I want to open a file stored on d:deepakdd then how to use fopen()
    : : : : whether it should be like that
    : : : : fp=fopen("d:deepakddd1.dat","r+")
    : : : :
    : : : : plz help
    : : : :
    : : : :
    : : :
    : : : fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
    : : :
    : : If you want to acces a file using the old C way then do it this way :
    : : FILE *fp;
    : : fp=fopen ("D:deepakddd1.dat","r+");
    : : that is it.
    : :
    :
    :
    : I don't know what "the C old way" is. Follow ANSI C and use the syntax I suggested.
    :
    :

  • bluj91bluj91 Posts: 133Member
    [b][red]This message was edited by bluj91 at 2006-11-15 15:40:57[/red][/b][hr]
    : i just want to say i was mistaken.I agree you did it the right way.
    : I am sorry for the misunderstanding.
    :
    : : : : : how to open a file on a perticular path i.e.
    : : : : : if I want to open a file stored on d:deepakdd then how to use fopen()
    : : : : : whether it should be like that
    : : : : : fp=fopen("d:deepakddd1.dat","r+")
    : : : : :
    : : : : : plz help
    : : : : :
    : : : : :
    : : : :
    : : : : fp=fopen("d:[red][/red]deepak[red][/red]dd[red][/red]d1.dat","r+")
    : : : :
    : : : If you want to acces a file using the old C way then do it this way :
    : : : FILE *fp;
    : : : fp=fopen ("D:deepakddd1.dat","r+");
    : : : that is it.
    : : :
    : :
    : :
    : : I don't know what "the C old way" is. Follow ANSI C and use the syntax I suggested.
    : :
    : :
    :
    :

    You see under c is an escape code and hence be foloowed somethingy. Example printing a will give you a head ache. Print
    will print a line break printing
    will return the carriage. Lot's of them there are. but in you case in order to put a backslash, , in C or C++ you must use the escape code \ for the backslash.

    And I think this has been implemented long before the dawn of time, ie. this is common 'the Old C'.

Sign In or Register to comment.