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

read string/character/data after specific searched string in same line only from a text file using C++

I have a text file and content is : # Details for object 1 ("PASperson") # Center point -- not available in other PASCAL databases -- refers # to person head center Original label for object 1 "PASperson" : "UprightPerson" Center point on object 1…
Kaushal Joshi
  • 33
  • 1
  • 1
  • 7
0
votes
1 answer

Write to specific part of preallocated file

I am currently trying to write to different locations of a pre-allocated file. I first allocated my file like so: File.open("file", "wb") { |file| file.truncate(size) } Size being the total size of the file. Afterwards I receive data of XX size…
randy newfield
  • 1,221
  • 3
  • 25
  • 38
0
votes
4 answers

Python: Inserting text after a tab in a text file

I want to insert some text after a tab character in a textfile. How can I do this in python? I have tried using Python seek() function. But is does not seem to take '\t'(for tab) as an argument. Thanks.
user189942
  • 351
  • 1
  • 3
  • 12
0
votes
1 answer

Make MP3 seekable in php

I am using below code to get a MP3 file via PHP. My problem is the MP3 which this code produces is not seeking. @$filename = $_GET['q'].'.mp3'; if(file_exists($filename)){ header("Content-type: audio/mpeg"); header('Content-length: ' .…
Sam
  • 1,424
  • 13
  • 28
0
votes
1 answer

Trying to make a Seek and Flee behavior. Cannot implicitly convert type 'void' to 'Microsoft.Xna.Framework.Vector2'

I'm trying to make a Seek and Flee behavior for an AI project. I tried putting the algorithm but I get this error. I'm not getting why it is not working and I could use some guidance. Here is the segment of code that isn't working: public Vector2…
zig
  • 3
  • 1
0
votes
1 answer

f.seek(0, SEEK_END) coming up as NoneType

I have some code that was written for Python 3 that I am trying to make Python 2.7 compatible. In Python 3, the code f.seek(0, SEEK_END) returns 320816 but in Python 2, the same code returns None. When I print the part of the file I'm interested in…
G Warner
  • 1,309
  • 1
  • 15
  • 27
0
votes
1 answer

Media Player seek option not working properly

Hello fellow developers. I made a c# player to play videos and audio. To do that I used the System.Windows.Media MediaPlayer and it works great. Here is the problem I encountered: In some music files (not all of them) seeking to X time or playing it…
Adi Bibi
  • 1
  • 2
0
votes
1 answer

Android Music player seekto(pos) play music at wrong Position

In my application, I am streaming a Mp3 files from the server. Streaming and load working perfectly . But the problem in the seekto in the media player, like I have 2 min mp3 ,if I have loaded it and play ,guess buffering go to the 100%, after…
Mayur Raval
  • 3,250
  • 6
  • 34
  • 57
0
votes
1 answer

How to create an indexed video file with Gstreamer

I'm trying to use Gstreamer to create a seekable (indexed) video file in Linux. My pipelines work for recording and saving the data, but I can't figure out how to index the data so I can seek using gst_element_seek_simple()…
linsek
  • 3,334
  • 9
  • 42
  • 55
0
votes
2 answers

decrease counter in iterable obtained using 'enumerate' after a calling seek

I am reading a file using Python, and within the file there are sections that are enclosed with the '#' character: #HEADER1, SOME EXTRA INFO data first section 1 2 1 233 ... // THIS IS A COMMENT #HEADER2, SECOND SECTION 452 134 // ANOTHER…
aaragon
  • 2,314
  • 4
  • 26
  • 60
0
votes
1 answer

Check if Youtube video ID match else load a new video id

I want to seek in youtube embed videos, but I have severals videos. I launch Video-A on startup I have a menu with 2 seek function Link A seek on Video-A Link B seek on Video-B So I need to check which video is playing before to seek: If video id…
Toinan
  • 25
  • 1
  • 8
0
votes
1 answer

Finding the time it would take to read a 1000 byte file

Disk D has one platter(2 surfaces), 200 tracks, 100 sectors/track, and sectors are 1KB. It rotates at 3600 RPM and average seek is 10ms. 1.) In the BEST CASE, how much time would it take to read a 1000 byte file? I know on AVERAGE CASE I simply…
user3444847
  • 65
  • 11
0
votes
1 answer

Finding strings in text files and seeking them

I would like to save strings into text files while ordering them, I need to do it by score (from 1-10) and these can be inputed in any random order. Is there a way to seek out strings in text files and then use the .seek() function there? I have it…
Alastair
  • 1
  • 1
0
votes
1 answer

How do you use open() with appending mode AND seek() in Python on Linux?

I have the following: with open(file, 'a') as log: #A bunch of code, some of it writes to log. log.seek(0) log.write(time.strftime(t_format)) seek() doesn't work with append, and if I use 'w', then the beginning of the file gets…
bmikolaj
  • 485
  • 1
  • 5
  • 16
0
votes
1 answer

How to seek stream pointer of a memory mapped file(using boost)?

I mapped my file to memory using boost::iostreams::mapped_file_source and declared a stream to read the file as boost::iostreams::stream streamReader. It worked fine and I was able to parse the memory mapped…
Jackzz
  • 1,417
  • 4
  • 24
  • 53