Jump to content

Not working

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
hbk

hbk

    Learning Programmer

  • Members
  • PipPipPip
  • 71 posts
i want to read a four digit number for a text file and then use that data.The problem is that i have tried using the w+ mode buts its opening the file and writing 1 to it and if i use the r+, it work but then when i open the file for a second time it reading the both numbers and not as four digit.

For example the file stores

1001// i want to read this content and overwrite this number with another four digit.

10011002/when i use r+ its printing this to the file but when i read from the file its gving me all the number.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
If it should only have one number at a time, why not read the number, close it, reopen it and overwrite the number?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
hbk

hbk

    Learning Programmer

  • Members
  • PipPipPip
  • 71 posts
thanks it worked