Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8276269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:19:24+00:00 2026-06-08T08:19:24+00:00

In Python: fo = open(foo.txt, r+) str = fo.read(10); position = fo.tell(); print Current

  • 0

In Python:

fo = open("foo.txt", "r+")  
str = fo.read(10);  
position = fo.tell();  
print "Current file position : ", position  

Is there a file pointer in R? Can I know where the current file position is while I read the file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:19:26+00:00Added an answer on June 8, 2026 at 8:19 am

    Well to look at file-related functions you can try ?file which tells you how to open a file and many file-related functions.

    fo <- file('foo.txt', 'r+') // see  ?file for more details on the parameters
    

    fo is a connection object that can be fed to other functions.
    I recommend you read all of ?file, which is very informative.

    In particular, see the See Also and Examples sections.

    In the See Also section are listed a set of related functions for working with files.
    In here it mentions (for example) readLines, readBin (to read binary files), scan (to read data into a vector or list) for reading files.

    It also mentions seek. Looking at ?seek you will see that

    seek with where = NA returns the current byte offset of a connection (from the beginning)

    So try

    seek(fo)
    

    (Tip – the help files in R are very helpful! The ‘See Also’ section will tell you functions related to the one you are looking at, and the ‘Examples’ section will give you examples of how to use them. If you wanted to look up stuff to do with files and ?file didn’t work, you could always do ??file which does a fuzzy search).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using os.system to open a file, eg: os.system(r'C:/foo.txt') , the current Python process,
I tried this code to open a file in Python: f = open("/Desktop/temp/myfile.txt","file1") It
How can i open file in python and write to it multiple times? I
I want to be able to use Python to open a .csv file like
The following code: with open(J:\\python\\.data) as data: self.data=pickle.load(data) generated the following error: File J:\python\code.py,
I need to create a file with python, in the directory: foo/bar/baz/filename.fil The only
How can one delete the very last line of a file with python? Input
for filename in os.listdir(.): for line in open(filename).xreadlines(): if foo in line: print line
I am using Python to open the physical disk in the computer to read
I have a simple example: #!/usr/bin/python import time import fcntl file = open(e, w)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.