- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- fseek,fread in c program
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 05:39 AM
тАО01-16-2007 05:39 AM
fseek,fread in c program
I am trying to position the file pointer randomly using fseek. This always positioned the file pointer to the beginning of the file until we changed the file attributes to Stream_LF. Then I could use fseek to position the file pointer, but now the fread function does not work properly. I've seen some talk on the web about fseek on vms not working properly, but I'm not sure how else to randomly read from a file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 05:46 AM
тАО01-16-2007 05:46 AM
Re: fseek,fread in c program
Using variable length record RMS files the program can only seek to 'record boundaries'.
This pretty much limits you to seek to locations you have previously found and recorded through tell.
Using stream_lf files the C RTL takes over from RMS, and knows how to do byte positioning.
You may also want to try "Undefined" RMS files ($SET FILE/ATTR=RFM=UDF), notably if there is no defined record structure, just blobs of data.
hth,
Hein van den Heuvel
HvdH Performance Consulting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 06:17 AM
тАО01-16-2007 06:17 AM
Re: fseek,fread in c program
Would it be useful to see the code or file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 08:51 AM
тАО01-16-2007 08:51 AM
Re: fseek,fread in c program
> should be end of the line.
If you're looking for the end-of-line, why
not use fgets() here?
> The fgets call returned an empty string.
Well, if it was right at the end of the line
(and not at the beginning of the next), ...
> Would it be useful to see the code or file?
It might. An actual (small) test case is
always handy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 08:58 PM
тАО01-16-2007 08:58 PM
Re: fseek,fread in c program
CRTL documentation is available at
http://h71000.www7.hp.com/doc/83final/5763/5763pro.html
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2007 02:52 AM
тАО01-18-2007 02:52 AM
Re: fseek,fread in c program
BAD FILE:
Record format: Stream_LF, maximum 0 bytes, longest 132 bytes
Record attributes: Carriage return carriage control
GOOD FILE:
Record format: Stream_LF, maximum 0 bytes, longest 32767 bytes
Record attributes: Carriage return carriage control
--
We tried to just change the file attributes to use 32767 bytes, but it still did not work until I created the new file.
-Thanks for the suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2007 04:56 AM
тАО01-18-2007 04:56 AM
Re: fseek,fread in c program
about what's in those files. A stray NUL
byte here or there can do bothersome things
to the C RTL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2007 05:06 AM
тАО01-18-2007 05:06 AM
Re: fseek,fread in c program
>>>
until we changed the file attributes to Stream_LF.
<<<
and
>>>
We tried to just change the file attributes to use 32767 bytes, but it still did not work until I created the new file.
<<<
So, _HOW_ did you change the attribs?
By just a
$ SET FILE/ATTR=,
or by a
$ CONVERT/FDL=
?
Just a SET file DOES change the DESCRIPTION of the file in the header, but _NOT_ the internal structure. And, for a programm that does not leave handling to RMS, the header is irrelevant.
>>>
I had to wirte a small program to read in the file from the beginning and then output it to a new file.
<<<
Effectively, what you did is write your own CONVERT, with the default C output format as an implicit FDL.
Hein can probably explain thin in much more detail and better wording.
fwiw,
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-19-2007 01:10 AM
тАО01-19-2007 01:10 AM
Re: fseek,fread in c program
Is there a better way if this is all that needs to be done? I'm sure we'll have to do this in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-19-2007 01:48 AM
тАО01-19-2007 01:48 AM
Re: fseek,fread in c program
I suspect most interested readers also wonder what the program did to make it right. Just get+put (read+write) in a look, or some end-of-line or null-byte-terminator processing? Did you try a simple CONVERT also?
May there was an MRS overruling the LRL?
Hope this helps some,
Hein.