I need to write some contents in the text file (notepad), with some specified font, and size .is it possible in C, kindly let me know.

Recommended Answers

All 3 Replies

Its not possible in any language. Files don't know a thing about fonts. As for Notepad.exe I know of no way to change it from a c program.

It's more accurate to say that Notepad doesn't know anything about fonts. Notepad is worthless. Forget that it exists.

as for creating custom documents, you can use Windows OLE Automation to programmatically create and modify MS Office documents (Word, Excel, etc.) complete with font and formatting and graphs and images and whatnot.. I guess this extends to Wordpad as well, since it can open basic .RTF and .DOC files.

It's been years since I did this, and I didn't do it in C. (I did it in Perl). all i remember was it was exceedingly tedious due to a poorly-documented API, but the final result (one i finally got it) was good. But i sure wouldn't want to go through it again.

so, if you really want to do this in C, then look it up and good luck. Although, i've got to say you might want to reconsider what you're trying to do, and why.


(PS: If you really want a good text editor, I recommend TextPad. Another good one is CrimsonEditor. Either one can be set to be the default application that opens .TXT files, and it will replace Notepad for good.)

.

It's more accurate to say that Notepad doesn't know anything about fonts. Notepad is worthless. Forget that it exists.

Notepad does now (win7) and I think it did in previous versions too. Menu Format --> Font. But it uses the same font for everything.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.