Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

going to a particular folder...

Status
Not open for further replies.

leela74

Programmer
May 11, 2001
26
IN
Hi,

I am facing a problem to go to a particular folder ad access a file..

The code goes like this...

# include <stdio.h>
# include <string.h>
# include <stdlib.h>

FILE *fp,*fs;

int main()
{
char name[8];
char command[20]=&quot;cd &quot;;

printf(&quot;Enter absolute path for Directory to be changed :&quot;);
scanf(&quot;%s&quot;,name);
strcat(command,name);
fflush(stdin);
system(command);
fp=fopen(&quot;abc.txt&quot;,&quot;r&quot;);
if(fp==NULL)
{
printf(&quot;\nNo such file&quot;);
exit(1);
}
printf(&quot;\nFile opened successfully....&quot;);
return 1;
}

I am unable to access file abc.txt in c:\abc\abc.txt.

Thanks in advance

Sridhar
 
fp=fopen(&quot;c:\\abc\\abc.txt&quot;,&quot;r&quot;); John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top