c - How to read file from local directory path -



c - How to read file from local directory path -

i have 1 function reads file , conversion part.

fp=fopen("newfile.txt","r");

here have copied newfile.txt in project file , compiling in vc++ 2008 ide.it works fine

i read file local drive directory path.is possible read files local drive.how mention path.if please mention example.

one more thing if want read files in particular folder out changing name of text files in above code. suggest me thing do.

i dont want alter file name manully in code

you utilize absolute path file:

file* fp = fopen("c:\\your_dir\\your_file.txt", "r"); if(fp) { // fclose(fp); }

or relative path, assuming file located in c:/etc , executable located in c:/etc/executables:

file* fp = fopen("..\\your_file.txt", "r"); if(fp) { // fclose(fp); }

c

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -