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. finding space in text file

finding space in text file

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
3 Posts 3 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.
  • S Offline
    S Offline
    shaans
    wrote on last edited by
    #1

    Hai ,can any body solve my problem?how can we find out the space character in a text file using vc++ ? An d also i want to replace that space to string .pls help me... shan

    N P 2 Replies Last reply
    0
    • S shaans

      Hai ,can any body solve my problem?how can we find out the space character in a text file using vc++ ? An d also i want to replace that space to string .pls help me... shan

      N Offline
      N Offline
      namaskaaram
      wrote on last edited by
      #2

      well.....it doent matter if u r using c/c++/vc++.....the method is the same... use the basic file operationz..... like fopen to open the file,fgetc()to get the character! eg: int a; ..... .... ... .. . a=fgetc(stream); ..... .... ... .. . and then if the value of a is 32(ascii) understand that it is space or if(fgetc(stream)==' ') by the way what do u mean by convert space to string????? "faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13

      1 Reply Last reply
      0
      • S shaans

        Hai ,can any body solve my problem?how can we find out the space character in a text file using vc++ ? An d also i want to replace that space to string .pls help me... shan

        P Offline
        P Offline
        pierrekande
        wrote on last edited by
        #3

        If your file is not so big, and if your project is link to MFC as shared lib, you can use the class CString to handle the text file. e.g. CString tmp(buffer); // where buffer contains data read from your file CString replaceString("myreplacestring"); while(tmp.Replace(" ",replaceString)); // Not all string like " " will be replace by "myreplacestring" and not " " THink this helps you

        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