First example that springs to mind? Jack Torrance. I'm sure you know him. Here we meet an aspiring writer who's trying to rebuild his life in a tranquil hotel in Colorado. When he starts to wield an axe things start getting a bit more exciting (and less tranquil for that matter) in The Shining. Or how about Paul Sheldon? Sounds familiar? It's the poor sod who ends up being rescued, and subsequently held hostage, by his fan Annie Wilkes in Misery.
But Stephen King isn't the only one who decided to make writers a main character of their books. Let's stay within the genre and turn to Marty Stillwater a bestselling mystery writer in Dean Koontz' Mr. Murder. And lets not forget short story writer Billy Wiles in his thrilling novel Velocity.
Though it's not only male writers who turn up in books. Just look at Ruth Cole from A Widow For A Year by John Irving. Or how about Vida Winter from Diane Setterfield's The Thirteenth Tale?
And ... there are many more examples, I'm sure, but those were the most obvious ones for me. Sadly enough I actually had to look the last two up *cough* so this blog post wouldn't be reduced to just two authors. Feel free to comment below with books where writers are main characters, so we can extend this list a bit!