- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsUsing Visual Studio 2005 in pure C (no C++) I have problems with writing a binary file using fopen() and fputc(). Here is my little test program:
int main (int argc, char* argv[])
{
FILE *fp;
fp = fopen ("crlf.tmp", "wb");
fwrite ("abc\n", 1, 4, fp);
fputc ('x', fp);
fputc ('y', fp);
fputc ('z', fp);
fputc ('\n', fp);
fclose (fp);
return 0;
}
When you look at the resulting file in a hex editor, in both cases the linefeeds are translated into a CR-LF pair. Which would be OK if the file was opened as default or as a text-file but not when it is opened in binary mode.
This has for me been an ongoing problem. Last time I circumvented it by replacing my C-style file I/O with MS specific calls like CreateFile() and ReadFile(). But this time I prefer to solve the problem "once and for all". :) Also I need this code to be platform independent and this problem doesn't occur on my Unix systems.
This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Advance your career with Experts Exchange. Plug into technology resources for professional development, including solutions, peer-reviewed articles, tutorials, and live training sessions.
It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. We love the accolades. We love to be seen as the digital white knight who fix...
They have been around for years and for thousands of Microsoft Outlook users and email administrators out there, they'd be lost without them: Personal Storage Table (PST) files. If you've worked with Outlook for very long, the name will immediately ring a bell; if you've ever adminis...
SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispersed nat...
Our expert teachers are leaders and respected professionals in their tech field and include over 300 Microsoft MVPs. The best part is they're passionate about sharing their expertise with you!
lrmoore has answered 13,534 questions on Experts Exchange since July 2000 and has more than 18 years experience in the networking industry. The six-time Microsoft MVP's specialties include firewalls, virtual private networking, and network management.
angeliii has answered 40,724 questions on Experts Exchange since March 2000. He is a Microsoft Most Valuable Professional for his work with MS SQL Server & Development. He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.
Leew has answered 19,673 questions on Experts Exchange since August 1997. He began working with computers in 1989 with a Turbo running DOS 3.3. Since then he has mastered Windows 2000 and XP operating systems, hard drives/storage and Small Business Server.
We’ve got experts and training resources for hundreds of technology topics. Whatever you need to learn, Experts Exchange has got you covered.
No matter where you find yourself in need of tech help, Experts Exchange is available for you with mobile site access from your smart phone or tablet.
Get full access to the help you need.
30-day free trial. Register in 60 seconds.
Bringing you the latest in technology
| Congressman Proposes Bill to Ban... | 11/28/12 |
| Death to Internet Anonymity: Google... | 11/27/12 |
| TEDx San Luis Obispo | 11/20/12 |
| SharePoint 2010 No-Code Solutions... | 11/19/12 |
| Keeping Your Passwords And Your Win... | 11/15/12 |
| Fun and Games with Hackers: How to... | 11/15/12 |
Listen while you work
Because of our active community of experts, on average new questions receive their first comment in under 30 minutes.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Business Accounts
Answer for Membership
I am very new to Crystal Reports and SQL Server databases, but -- with the help of Experts Exchange -- I have been able to meet my deadlines and produce effective products.
I love EE and have been a member since 2004. I just today started my third contract assignment which I attribute to the skills I am learning from other experts.
It's my sole resource as I'm kind of an MS Access loner at my company. It's like having colleagues available when I run out of my own steam.