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

Android audio player getting problem: seekbar doesn't go to position set

I want to seek my video to perticular postion using seekbar I've tried this but seekbar not working I mean to say I change its position but video doesn't seek to that position. What I am doing wrong? My code is as below: package…
Android
  • 8,995
  • 9
  • 67
  • 108
0
votes
2 answers

How do I go two characters left from the current position in file in Python?

I am doing a project and in it I have to frequently edit a file from the position somewhere in the center. I want to go to the 2 characters left to the position from where the word 'rules' starts. I have tried something like this: with…
Khubaib Khawar
  • 51
  • 1
  • 11
0
votes
2 answers

Run a function when seek event completes

I have these two functions: async takeScreenShot() { this.pauseVideo(); if (this.animations.length && !this.ended) { this.pauseLotties() } this.captures.push(this.canvas.toDataURL('image/webp')); if (!this.ended) { setTimeout(() =>…
codernoob8
  • 434
  • 1
  • 9
  • 24
0
votes
0 answers

Text file read offset is not consistent with the block defined by seek and tell in python

I want to read a large text file block by block define by offsets. Before that, I used file.tell to define the start position of each block by quick screening the file with file.seek(0), i.e., from start of the file. Then each block is defined by…
Elkan
  • 546
  • 8
  • 23
0
votes
0 answers

How can specific replacements be formatted in a file?

sample_file.txt line1 line2 Apple line4 line5 line6 line7 line8 line9 Orange line11 line12 line13 line14 line15 some_text line17 line19 line20 line21 line23
StackGuru
  • 471
  • 1
  • 9
  • 25
0
votes
2 answers

How to pass a binary file as stdin to a Docker containerized Python script using argparse?

Update based on Anthony Sottile's Answer I re-implemented his solution to simplify the problem. Lets take Docker and Django out of the equation. The goal is to use Pandas to read excel by both of the following methods: python example.py - <…
dnk8n
  • 675
  • 8
  • 21
0
votes
1 answer

Determine whether PHP stream support seeking

For an internal module we're writing an abstraction for handling streams. Thing is that the stream itself is actually parsed when instantiating the abstraction (thus file or url). At that point, I need to determine whether the stream supports…
Dygnus
  • 621
  • 6
  • 14
0
votes
0 answers

Capturing canvas to video in fastes way

I'm capturing canvas which contains things like videos, images and text, but I capture each frame per frame, using the onseeked event to capture the next frame after seeking the video to the desired frame. But it's taking a long time. Is there a way…
0
votes
2 answers

Binary file only overwrites first line C++

So I have a binary file that I create and initialize. If I set my pointer to seekg = 0 or seekp = 0, then I can overwrite the line of text fine. However if I jump ahead 26 bytes (the size of one line of my file and something I have certainly…
zmarine
  • 21
  • 1
  • 6
0
votes
1 answer

JW Player - Disabling fast forward not working in Microsoft Edge/IE11/Safari

I'm using JW Player v8.10.3 and I want to disable fast forwarding in Chrome, Firefox, IE11, Microsoft Edge and Safari. The code below works in Chrome and Firefox. To reproduce the issue, on Microsoft Edge/IE11/Safari, click on a future time at least…
Brian
  • 1
  • 1
0
votes
1 answer

Which subclasses of the STream class support seeking in C# (not in the docs ffs)

Generally, I just want to know which streams in C# support seeking. I checked the docs and the Microsoft geniuses explained the concept, but didn't actually say which ones can be seeked.
0
votes
3 answers

download using wget in perl

New to Perl, hope someone could kindly explain the following questions related to this code: $url ="some url"; open FH, "wget -q -O- $url|" or die; while(){ ... } what does the the second - in -O- mean? what does the | in $url |…
user685275
  • 2,097
  • 8
  • 26
  • 32
0
votes
1 answer

SQLite seek question

I'm using SQLite version 3 to run the following code. //Run SQL SELCT query sqlite3_prepare16_v2("SELECT * FROM table_name"); sqlite3_step(); //Need to review results in several iterations for(int i = 0; i < n; i++) { //Seek to beginning …
ahmd0
  • 16,633
  • 33
  • 137
  • 233
0
votes
1 answer

How can it be that "not all file objects are seekable", according to pydoc?

I ran "pydoc file.seek" and this line from documentation puzzled me. "Note that not all file objects are seekable." As far as I understand, "not seekable" means "you can't use seek, even if you have access permission". I don't understand, how is it…
KarmaPeasant
  • 103
  • 3
0
votes
0 answers

Speeding up multiple seeks by prefilling ifstream buffers

I want to speed up thousands of seeks and reads increasingly forward in a 1G contiguous section of a huge file(~10G) at a known offset(say 8G). i.e. the pattern looks like: seek(8.00G), read(128 bytes), seek(8.01G), read(56 bytes), and onward. Basic…
tangy
  • 3,056
  • 2
  • 25
  • 42