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
0 answers

seek() vs read() speed in python

I have a rather naive question about speed performance of reading from a file in python. I am implementing an application which needs to read from a binary file. The data is organised in blocks (events, all occupying the same space and encoding the…
FredS
  • 3
  • 2
0
votes
1 answer

Excel VBA GoalSeek by each row in a table

I am looking to perform a goal seek within each row of a specified table. The following VBA code successfully executes the GoalSeek. Sub GoalSeek() Dim lo As ListObject Dim rw Set lo = Sheet1.ListObjects("Table1") For rw =…
0
votes
1 answer

Searching + reverse seeking a pickled file , values getting skipped

Minimum reproducible example, only goto_index() is being used in my code. The rest is self-explanatory : import pickle,os def goto_index(idx_str,src,dest=False) : '''Go to index : 1. Convert 1-based comma seperated digits in idx_str into…
user426
  • 213
  • 2
  • 9
0
votes
1 answer

seek() function not working in a nested loop

I am building a custom "translator" for abbreviations. It is supposed to take a string input, split it into the individual words and return each word as an abbreviation. Example: Input: above and aloft Returns: abv & alft The abbreviations are…
0
votes
0 answers

Video seek not working in vue-cli-plugin-electron-builder

I am trying to add a simple HTML5 player that loads a local mp4 file. I've added the stream: true in background.js. The video loads but the seek is not working. It seems it's just working in serve mode but not in the build. As a difference I have…
0
votes
1 answer

Python: scan file for substring, save position, then return to it

I'm writing a script that needs to scan a file until it finds the line at which a substring occurs, save the position of the beginning of that line, then return to it later. I'm very new to python, so I've not had much success yet. Here is my…
Kronimiciad
  • 190
  • 1
  • 2
  • 11
0
votes
0 answers

Weird seek behaviour in C and C++

I had a strange bug with file access (windows) in my program, where some file index calculations would not point to the correct symbol in the file. I could isolate the error the seek incrementation behavior and tested it in two loops. Once in the C…
0
votes
0 answers

High seek time due to multi-step traversal in FAT tables

In a FAT-based file system design, the 'seek' involves traversing the links present in the FAT table, like in a linked list. It moves the current pointer within the file (pointed to by the file descriptor) forward by a distance of, say 'O' offset…
Helium Ark
  • 11
  • 2
0
votes
3 answers

SWF file seek information

Is it possible to get and set seek position of a swf file (either in ActionScript 2/3 or ActiveX API of Flash Player) ? I tried to use frame number at first (to determine which part of the movie is being played) however sometimes whole animation has…
Hayri Uğur Koltuk
  • 2,970
  • 4
  • 31
  • 60
0
votes
2 answers

extract the commented lines only if the following line is not commented

I have a file as follows: cat file.txt # unimportant comment # unimportant comment # unimportant comment # important line blah blah blah blah blah blah # insignificant comment # significant comment xyz xyz I would like to print the lines that start…
Shahin
  • 1,196
  • 1
  • 8
  • 15
0
votes
0 answers

Python 3, Negative seek() Problem with Terrabyte Text File,

I'm in the middle of a very large text file (nowhere near the EOF) opened like so: iFile = open('big.csv', 'rb') The good thing is that each line of data has the same length. So, moving FORWARD through the file is simply a multiple of that line…
aaxiom
  • 3
  • 3
0
votes
1 answer

php uploaded video is not seek forward on chrome, (seekbar not working)

So i have a simple php script which uploads the video file to the server then after the upload when i load that video on a video page the seek bar of the video element is not working on chrome browser. it works fine on firefox but does not work on…
0
votes
1 answer

a strange result in python using open function with a+ mode

My question is about Python build-in open function with a+ mode. First, from this thread, I know for a+ mode, subsequent writes to the file will always end up at the current end of file. I write the following simple program to confirm this…
0
votes
1 answer

Turn index scan to an index seek

I've added an index to a table to stop a table scan. Now it scans the index instead of the table, why doesn't it perform an index seek? CREATE PROCEDURE [dbo].[GetPeople] ( @PlaceIDs [dbo].[Integers] READONLY, @RoleGroupIDs [dbo].[Integers]…
0
votes
1 answer

AttributeError: 'ConvertModel' object has no attribute 'seek'

I tried converting a MATLAB model to PyTorch using ONNX, like proposed here by Andrew Naguib: How to import deep learning models from MATLAB to PyTorch? I tried running the model using the following code: import onnx from onnx2pytorch import…
Oubi
  • 15
  • 4