fscanf whole line

This is a discussion on fscanf whole line within the C++ Programming forums, part of the General Programming Boards category; Is there a way to read the whole line from a .txt file, that contains spaces and write it to ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    62

    fscanf whole line

    Is there a way to read the whole line from a .txt file, that contains spaces and write it to one string? Is there a function for it or do I have to try some longer code.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Don't use fscanf(). Since you posted this in the C++ section, you're best off with getline() or something. Otherwise, if you're really using C, use fgets().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. adding line numbers and concatenating a filename
    By durrty in forum C Programming
    Replies: 25
    Last Post: 06-28-2008, 04:36 AM
  2. Reading a buffer line by line, while using system read
    By Hammad Saleem in forum C Programming
    Replies: 9
    Last Post: 05-27-2008, 06:41 AM
  3. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 07:58 AM
  4. Adding Line numbers in Word
    By Mister C in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 06-24-2004, 09:45 PM
  5. Validating the contents of a char buffer
    By mattz in forum C Programming
    Replies: 3
    Last Post: 12-09-2001, 06:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21