Questions tagged [seek]

Seeking is the act of moving around a file or file-like object.

Seeking is the act of moving around a file or file-like object.

ANSI C in section 2.3.12.10 specifies thatfseek has the argument structure:

int fseek(FILE *stream, long offset, int whence);

Where:

  • stream is the FILE object to seek (note that this does not have to physically be a file)
  • offset is how much, relative to the whence argument
  • whence is one of
    • SEEK_SET (offset is computed relative to the start of the file)
    • SEEK_CUR (offset is computed relative to the current position)
    • SEEK_END (offset is computed relative to the end of the file)

The majority of languages based upon C, and even many that aren't, have inherited something similar to fseek, but have probably put it somewhere else (ex. Python's file.seek). Check your language of choice's documentation for details.

537 questions
0
votes
1 answer

NullPointerException using RandomAccesssFile at seek

I want to introduce information about cars and keep it in a file. My problem is that when I introduce datas it show me has occurred a NullPointerException where I use "seek" to place the pointer where I want. I have a Java Class that I use to ask…
Noneking
  • 11
  • 1
0
votes
2 answers

How to directly access a certain part of a text file in g++?

I have a text file containing a number of records. Each record is stored on a single line that is 100 characters long. Let's say I want to directly access the nth record. I could do it using a for loop, reading in n lines until I get to the…
neuromancer
  • 53,769
  • 78
  • 166
  • 223
0
votes
0 answers

Moving some lines back in Java Buffer Reader Loop (Re-reading) based on a condition

I am reading a 15 Million file using Java BUfferReader. In some conditions, I have to loop back 1000 lines in the buffer and RE-READ them, and then continuing them with the next records after those 1000. In simple words I want to be able to have…
Noman K
  • 277
  • 1
  • 5
  • 15
0
votes
1 answer

Adding to the beginning of a file in python

Does anyone know of a easy way to enter a file at the beginning and add to it on the first line? I tried doing the following: f.seek(0) f.write("....") f.close() The only problem is that it doesn't add a new first line with what I want, rather…
learner
  • 137
  • 1
  • 1
  • 6
0
votes
1 answer

using seek and searching for a file

so I've written this code which allows the user to search for a text file with a specific name, then enter the first name from the text file and actually edit what's written in that line. i.e. search for a text file called lions, and then edit the…
0
votes
1 answer

Is there a faster way to skip parts of binary file than FileStream.Position

I need to read throug a very large amount of binary data from file. I have a fixed record size (38) and would like to skip several records at a time. I have tried doing this using FileStrea, Position or Seek, but it seems that take a finitie amount…
ManInMoon
  • 6,795
  • 15
  • 70
  • 133
0
votes
1 answer

Trying to reread redirected file using seekg()

I am trying to read a redirected file using cin.get(). This is my attemp at using seekg, but it's not working correctly. int temp; while(cin.get(temp)) { //code here } cin.seekg(0,ios::beg); if(cin.fai()) { cout << "failed";// it fails }
azureskys
  • 13
  • 6
0
votes
2 answers

how to divide file into chunks for multi processing

I have file of around 1.5 Gb and I want to divide file into chunks so that I can use multi processing to process each chunk using pp(parallel python) module in python. Till now i have used f.seek in python but it takes a lot of time, as it may be…
Aman Jagga
  • 301
  • 5
  • 15
0
votes
0 answers

How to insert text into the middle of a Microsoft Word template/document?

Is there a good way to perform an insert of text into the middle of an existing Word document using PowerShell? It appears straightforward to open from a template: $TemplatePath = "C:\Template.dotx" $SavePath = "C:\Saved.docx" $Word = New-Object…
Matt
  • 1
  • 1
  • 1
0
votes
1 answer

Why am I getting error while trying to seek in my streaming video player

I'm building a video player here: http://leongaban.com/stackoverflow/RTMP/ It's streaming RTMP, and I'm trying to get my video to seek correctly if the user clicks on the groove bar (gray bar under the green progress bar) Currently it does not seek…
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
0
votes
2 answers

flowplayer flash seek goes to wrong second

I have a problem where seek method of flowplayer is not going to the exact second specified - it's goes to about 8 seconds instead of 10. Jsfiddle Example var $player = $('#player'); var video = flowplayer($player[0], { src:…
Joel Cox
  • 3,289
  • 1
  • 14
  • 31
0
votes
0 answers

How would I implement a file-based lookup table on Android?

I am building an Android application, which loads a large dictionary into memory, such that remaining RAM is very limited. I need to reference a second large word-list, but don't have the space to load it into RAM. Since the "disk" on an Android…
Brent
  • 16,259
  • 12
  • 42
  • 42
0
votes
1 answer

Using Perl's SEEK to jump to a line in a file and continuing to read the file

My goal is to open a file containing a single column of fixed length (1 character = 2 bytes on my Mac), and then to read the lines of the file into an array, beginning and ending at specified points. The file is very long, so I am using the seek…
ES55
  • 490
  • 1
  • 5
  • 14
0
votes
1 answer

Read data from each column and finally print it in a row in perl

I'm writing a script to read a large file(>10 GB) and write the data from an array to the end of each line in that file. Here is my code my $count=0; while(my $lines = <$FILE>){ seek $FILE, length($lines), 1; print $FILE "\t",…
Robin
  • 3
  • 1
0
votes
1 answer

libvlc: seek issues in IOS

how to seek using VLC?? The demo code as flowing doesn't work either. /* we need to limit the number of events sent by the slider, since otherwise, the user * wouldn't see the I-frames when seeking on current mobile devices. This isn't a…