Im trying to open a file, and then read a user defined number of characters from said file. I want to do this using scanf but I can't quite figure out how it works. I can get scanf to work just fine but I can't determine how to specify the maximum number of characters to read.
dansnyderECE 0 Junior Poster
Recommended Answers
Jump to PostHave you looked into using ifstream? This is the "new way" to read files where scanf is the "old way".
Jump to PostThere is a function called getline(), I'm not familiar with just get(). But you can use the >> operator with ifstream. Take a look and let us know when you run into a particular question.
Dave
All 5 Replies
daviddoria 334 Posting Virtuoso Featured Poster
dansnyderECE 0 Junior Poster
daviddoria 334 Posting Virtuoso Featured Poster
Radical Edward 301 Posting Pro
dansnyderECE 0 Junior Poster
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.