Specifying a file extension in C -



Specifying a file extension in C -

for project getting file name user , sending function create actual file/open if exists. problem having when compiler creates file...it literally that, file. how can specify file type after receiving name via command line?

from main:

printf("enter name of file in wish create\nor if know name of exisiting file, come in file name:\n"); scanf(" %s", fname); file = fileopen(fname);

the function:

file *fileopen(char* fname) { file* pfile; pfile = fopen(fname,"rb+"); if (!pfile) pfile = fopen(fname,"wb+"); homecoming pfile;

here ended doing after digging around/help friend.

sprintf(fname, "%s%s", fname, ".dat");

thanks replies

c file-io

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -