Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Is it a Text file?

Is it a Text file?

Scheduled Pinned Locked Moved C / C++ / MFC
perlc++testingbeta-testingtools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 518
    wrote on last edited by
    #1

    I am converting a Perl script to a C++ Class. A function requires files to be tested as to whether they are Text files or a Binary files. Is there a method for testing a file on a windows platform?

    K 1 Reply Last reply
    0
    • U User 518

      I am converting a Perl script to a C++ Class. A function requires files to be tested as to whether they are Text files or a Binary files. Is there a method for testing a file on a windows platform?

      K Offline
      K Offline
      Kurt 0
      wrote on last edited by
      #2

      Hi Just use a CFile and read it. Go through the data using isalnum and as soon as you get a FALSE return and it is not a carriage return or line feed you'll know it is binary.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups