read space through file handeling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shariquehabib
    New Member
    • Oct 2006
    • 22

    read space through file handeling

    Hi All,

    I am using file handeling in C lang.

    Can anyone please let me know that how can i read spaces from a perticular file??

    To read some values (strings) i m using fscanf func.

    Can anyone plz help me on this.


    Thanks,
    Sharique
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    you can read character by character and find out whether it is a space.
    To read character by character you shuld us fgetc()

    Raghu

    Comment

    • shariquehabib
      New Member
      • Oct 2006
      • 22

      #3
      Thanks ..i will try this...

      Originally posted by gpraghuram
      you can read character by character and find out whether it is a space.
      To read character by character you shuld us fgetc()

      Raghu

      Comment

      • shariquehabib
        New Member
        • Oct 2006
        • 22

        #4
        Hi Rahgu,

        I want to read from a file which is having space delimeters and more than 5 rows like:

        Reuters syr2d2 SSL_D2000 Y U REUTERS
        EBS ebsctrl SSL_D2000 N B EBS
        F1XONLINE fxolimp f1xonline_deals X F F1XONLINE FXLOC

        at line 1 and 2 ..in the last space is there...so want to read that space...

        Can u suggest me on this?


        Originally posted by gpraghuram
        you can read character by character and find out whether it is a space.
        To read character by character you shuld us fgetc()

        Raghu

        Comment

        • gpraghuram
          Recognized Expert Top Contributor
          • Mar 2007
          • 1275

          #5
          Originally posted by shariquehabib
          Hi Rahgu,

          I want to read from a file which is having space delimeters and more than 5 rows like:

          Reuters syr2d2 SSL_D2000 Y U REUTERS
          EBS ebsctrl SSL_D2000 N B EBS
          F1XONLINE fxolimp f1xonline_deals X F F1XONLINE FXLOC

          at line 1 and 2 ..in the last space is there...so want to read that space...

          Can u suggest me on this?
          What you can do is convert the file with space at end to someother character using sed in Unix and the do the normal reading.
          At the end convert the character to space.

          raghu

          Comment

          Working...