File pointer is valid

I'm curious if any of NI's efforts at enhancing memory management has provided the ability to determine if a file pointer (stream handle) is valid prior to using it?
fopen is of type FILE *, and if fclose is called on it, then it's no longer valid but it's not NULL either.  I believe this is usually implemented as a malloc of a struct to hold the file info, so it's maybe the same issue as trying to determine if a malloc pointer is valid or not.
Is there any way to tell if a value of type FILE * is valid other than to try using it?  It's a fatal error if it's bad and you use it in an fclose, fread, fwrite, etc.  In std C, it's especially problematic since we can't catch the exception - you're guaranteed a program crash.
This may be an argument for using the WinAPI file functions Vs. the C std library file functions.
Thanks for any insight into this.

Actually, it would have been nice if fclose set the stream to NULL on its own, but I do set it to NULL after an fclose, and I check for the stream being NULL prior to every use.
My problem was with a multi-threaded app that could catch the file closed but the stream not yet NULL.
So I had to use a lock to coordinate access between the threads to prevent this.
fopen, fclose, fwrite etc are part of the C std library (as implemented by NI), as opposed to the OpenFile, CloseFile, WriteFile calls which use handles, as do the WinAPI file i/o calls.  The handle abstraction allows the implementation to avoid using a raw pointer that can be improperly dereferenced and cause an exception that a CVI C app can't catch.
It might be that the C89 / C99 std requires the std lib implementation to use a pointer for the stream, as the language calls it a "stream" but it's type is actually FILE *.
So I'm complaining about C std lib more so than the CVI std lib implementation I suppose.
After all, NI came up with its own CVI file I/O package separate from the C std lib file i/o, and NI did use handles for this other library.  If you misuse a handle, you don't get a fatal error, you get a return status indicating an error.  The issue is that the C std lib calls are standard (i.e. portable), and fairly easy to understand and use, so it'd be nice to use them.

Similar Messages

  • SQL LOADER  message : Point de validation COMMIT atteint - nombre d'enreg

    Hello
    I am loading a csv file into an oracle table via SQL LOADER
    Each time i invoke it i get the folowing message :
    SQL LOADER message : Point de validation <COMMIT> atteint - nombre d'enregis. logiques 52. (i am french version of apex)
    And the table is left empty.
    The translation of the above message is :
    SQL LOADER Validation Point <COMMIT> reached. number of logical records 52
    What doese it mean ?
    Thanks in advance.

    Yes
    my table is empty and
    and this is my control file :
    load data
    infile 'i:\csvs\mvh051.csv'
    into table mvhist051
    fields terminated by ';' optionally enclosed by '"'
    (ETABLI,NUPIECE,NUMLIGNE,DATEOP,JOURNAL,COMPTE,CODEN,LIBELLE,MONTANT,SENS,DATEVALEUR,OPERATION,NPIECE,CORIG,SOLDE,MVAPUR)
    hear is a sample of bide file :
    5100;2052;1;01/01/2005;ARB;1120060;0;report de solde 2004;6122867,27;D;01/01/2005;98;;1
    5100;2053;1;01/01/2005;ARB;1120070;0;report de solde 2004;223639,17;D;01/01/2005;98;;1
    5100;2054;1;01/01/2005;ARB;1261000;0;report de solde 2004;4680204207,00;D;01/01/2005;98;;1
    5100;2055;1;01/01/2005;ARB;1271100;0;report de solde 2004;81895715591,44;D;01/01/2005;98;;1
    ETABLI;NUPIECE;NUMLIGNE;DATEOP;JOURNAL;COMPTE;CODEN;LIBELLE;MONTANT;SENS;DATEVALEUR;OPERATION;NPIECE;CORIG;SOLDE;MVAPUR
    Please not that the last line is the heading columns names. I dont under stand why
    it is copied.

  • REST API: Create Deployment throwing error BadRequest (The specified configuration settings for Settings are invalid. Verify that the service configuration file is a valid XML file, and that role instance counts are specified as positive integers.)

    Hi All,
    We are trying to access the Create Deployment method stated below
    http://msdn.microsoft.com/en-us/library/windowsazure/ee460813
    We have uploaded the Package in the blob and browsing the configuration file. We have checked trying to upload manually the package and config file in Azure portal and its working
    fine.
    Below is the code we have written for creating deployment where "AzureEcoystemCloudService" is our cloud service name where we want to deploy our package. I have also highlighted the XML creation
    part.
    byte[] bytes =
    new byte[fupldConfig.PostedFile.ContentLength + 1];
                fupldConfig.PostedFile.InputStream.Read(bytes, 0, bytes.Length);
    string a = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
    string base64ConfigurationFile = a.ToBase64();
    X509Certificate2 certificate =
    CertificateUtility.GetStoreCertificate(ConfigurationManager.AppSettings["thumbprint"].ToString());
    HostedService.CreateNewDeployment(certificate,
    ConfigurationManager.AppSettings["SubscriptionId"].ToString(),
    "2012-03-01", "AzureEcoystemCloudService", Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot.staging,
    "AzureEcoystemDeployment",
    "http://shubhendustorage.blob.core.windows.net/shubhendustorage/Infosys.AzureEcoystem.Web.cspkg",
    "AzureEcoystemDeployment", base64ConfigurationFile,
    true, false);   
    <summary>
    /// </summary>
    /// <param name="certificate"></param>
    /// <param name="subscriptionId"></param>
    /// <param name="version"></param>
    /// <param name="serviceName"></param>
    /// <param name="deploymentSlot"></param>
    /// <param name="name"></param>
    /// <param name="packageUrl"></param>
    /// <param name="label"></param>
    /// <param name="base64Configuration"></param>
    /// <param name="startDeployment"></param>
    /// <param name="treatWarningsAsError"></param>
    public static
    void CreateNewDeployment(X509Certificate2 certificate,
    string subscriptionId,
    string version, string serviceName, Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot deploymentSlot,
    string name, string packageUrl,
    string label, string base64Configuration,
    bool startDeployment, bool treatWarningsAsError)
    Uri uri = new
    Uri(String.Format(Constants.CreateDeploymentUrlTemplate, subscriptionId, serviceName, deploymentSlot.ToString()));
    XNamespace wa = Constants.xmlNamespace;
    XDocument requestBody =
    new XDocument();
    String base64ConfigurationFile = base64Configuration;
    String base64Label = label.ToBase64();
    XElement xName = new
    XElement(wa + "Name", name);
    XElement xPackageUrl =
    new XElement(wa +
    "PackageUrl", packageUrl);
    XElement xLabel = new
    XElement(wa + "Label", base64Label);
    XElement xConfiguration =
    new XElement(wa +
    "Configuration", base64ConfigurationFile);
    XElement xStartDeployment =
    new XElement(wa +
    "StartDeployment", startDeployment.ToString().ToLower());
    XElement xTreatWarningsAsError =
    new XElement(wa +
    "TreatWarningsAsError", treatWarningsAsError.ToString().ToLower());
    XElement createDeployment =
    new XElement(wa +
    "CreateDeployment");
                createDeployment.Add(xName);
                createDeployment.Add(xPackageUrl);
                createDeployment.Add(xLabel);
                createDeployment.Add(xConfiguration);
                createDeployment.Add(xStartDeployment);
                createDeployment.Add(xTreatWarningsAsError);
                requestBody.Add(createDeployment);
                requestBody.Declaration =
    new XDeclaration("1.0",
    "UTF-8", "no");
    XDocument responseBody;
    RestApiUtility.InvokeRequest(
                    uri, Infosys.AzureEcosystem.Entities.Enums.RequestMethod.POST.ToString(),
    HttpStatusCode.Accepted, requestBody, certificate, version,
    out responseBody);
    <summary>
    /// A helper function to invoke a Service Management REST API operation.
    /// Throws an ApplicationException on unexpected status code results.
    /// </summary>
    /// <param name="uri">The URI of the operation to invoke using a web request.</param>
    /// <param name="method">The method of the web request, GET, PUT, POST, or DELETE.</param>
    /// <param name="expectedCode">The expected status code.</param>
    /// <param name="requestBody">The XML body to send with the web request. Use null to send no request body.</param>
    /// <param name="responseBody">The XML body returned by the request, if any.</param>
    /// <returns>The requestId returned by the operation.</returns>
    public static
    string InvokeRequest(
    Uri uri,
    string method,
    HttpStatusCode expectedCode,
    XDocument requestBody,
    X509Certificate2 certificate,
    string version,
    out XDocument responseBody)
                responseBody =
    null;
    string requestId = String.Empty;
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
                request.Method = method;
                request.Headers.Add("x-ms-Version", version);
                request.ClientCertificates.Add(certificate);
                request.ContentType =
    "application/xml";
    if (requestBody != null)
    using (Stream requestStream = request.GetRequestStream())
    using (StreamWriter streamWriter =
    new StreamWriter(
                            requestStream, System.Text.UTF8Encoding.UTF8))
                            requestBody.Save(streamWriter,
    SaveOptions.DisableFormatting);
    HttpWebResponse response;
    HttpStatusCode statusCode =
    HttpStatusCode.Unused;
    try
    response = (HttpWebResponse)request.GetResponse();
    catch (WebException ex)
    // GetResponse throws a WebException for 4XX and 5XX status codes
                    response = (HttpWebResponse)ex.Response;
    try
                    statusCode = response.StatusCode;
    if (response.ContentLength > 0)
    using (XmlReader reader =
    XmlReader.Create(response.GetResponseStream()))
                            responseBody =
    XDocument.Load(reader);
    if (response.Headers !=
    null)
                        requestId = response.Headers["x-ms-request-id"];
    finally
                    response.Close();
    if (!statusCode.Equals(expectedCode))
    throw new
    ApplicationException(string.Format(
    "Call to {0} returned an error:{1}Status Code: {2} ({3}):{1}{4}",
                        uri.ToString(),
    Environment.NewLine,
                        (int)statusCode,
                        statusCode,
                        responseBody.ToString(SaveOptions.OmitDuplicateNamespaces)));
    return requestId;
    But every time we are getting the below error from the line
     response = (HttpWebResponse)request.GetResponse();
    <Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <Code>BadRequest</Code>
      <Message>The specified configuration settings for Settings are invalid. Verify that the service configuration file is a valid XML file, and that role instance counts are specified as positive integers.</Message>
    </Error>
     Any help is appreciated.
    Thanks,
    Shubhendu

    Please find the request XML I have found it in debug mode
    <CreateDeployment xmlns="http://schemas.microsoft.com/windowsazure">
      <Name>742d0a5e-2a5d-4bd0-b4ac-dc9fa0d69610</Name>
      <PackageUrl>http://shubhendustorage.blob.core.windows.net/shubhendustorage/WindowsAzure1.cspkg</PackageUrl>
      <Label>QXp1cmVFY295c3RlbURlcGxveW1lbnQ=</Label>
      <Configuration>77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0NCiAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KDQogIFRoaXMgZmlsZSB3YXMgZ2VuZXJhdGVkIGJ5IGEgdG9vbCBmcm9tIHRoZSBwcm9qZWN0IGZpbGU6IFNlcnZpY2VDb25maWd1cmF0aW9uLkNsb3VkLmNzY2ZnDQoNCiAgQ2hhbmdlcyB0byB0aGlzIGZpbGUgbWF5IGNhdXNlIGluY29ycmVjdCBiZWhhdmlvciBhbmQgd2lsbCBiZSBsb3N0IGlmIHRoZSBmaWxlIGlzIHJlZ2VuZXJhdGVkLg0KDQogICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCi0tPg0KPFNlcnZpY2VDb25maWd1cmF0aW9uIHNlcnZpY2VOYW1lPSJXaW5kb3dzQXp1cmUxIiB4bWxucz0iaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS9TZXJ2aWNlSG9zdGluZy8yMDA4LzEwL1NlcnZpY2VDb25maWd1cmF0aW9uIiBvc0ZhbWlseT0iMSIgb3NWZXJzaW9uPSIqIiBzY2hlbWFWZXJzaW9uPSIyMDEyLTA1LjEuNyI+DQogIDxSb2xlIG5hbWU9IldlYlJvbGUxIj4NCiAgICA8SW5zdGFuY2VzIGNvdW50PSIyIiAvPg0KICAgIDxDb25maWd1cmF0aW9uU2V0dGluZ3M+DQogICAgICA8U2V0dGluZyBuYW1lPSJNaWNyb3NvZnQuV2luZG93c0F6dXJlLlBsdWdpbnMuRGlhZ25vc3RpY3MuQ29ubmVjdGlvblN0cmluZyIgdmFsdWU9IkRlZmF1bHRFbmRwb2ludHNQcm90b2NvbD1odHRwcztBY2NvdW50TmFtZT1zaHViaGVuZHVzdG9yYWdlO0FjY291bnRLZXk9WHIzZ3o2aUxFSkdMRHJBd1dTV3VIaUt3UklXbkFrYWo0MkFEcU5saGRKTTJwUnhnSzl4TWZEcTQ1ZHI3aDJXWUYvYUxObENnZ0FiZnhONWVBZ2lTWGc9PSIgLz4NCiAgICA8L0NvbmZpZ3VyYXRpb25TZXR0aW5ncz4NCiAgPC9Sb2xlPg0KPC9TZXJ2aWNlQ29uZmlndXJhdGlvbj4=</Configuration>
      <StartDeployment>true</StartDeployment>
      <TreatWarningsAsError>false</TreatWarningsAsError>
    </CreateDeployment>
    Shubhendu G

  • WSDL URL is invalid or the WSDL file is not valid or incorrect

    Hi All,
    I am using Oracle Soa Suite 11g. I have got Oracle database, Oracle weblogic admin server, Oracle SOA server all installed on my laptop.
    I have deployed a sample BPEL process. When I am trying to test the process it is giving an error
    "Either the WSDL URL is invalid or the WSDL file is not valid or incorrect. - WSDLException: faultCode=PARSER_ERROR: Failed to read wsdl file at: "http://KSNPavan-PC:8001/soa-infra/services/default/MyHumanWorkFlowSample1Project/vacationrequestprocess_client_ep?WSDL", caused by: java.net.ConnectException. : java.net.ConnectException: Connection refused: connect "
    Now, when I change the url address to
    "http://localhost:8001/soa-infra/services/default/MyHumanWorkFlowSample1Project/vacationrequestprocess_client_ep?WSDL"
    (Please note the difference in host name from KSNPavan-PC to localhost.)
    and click parse wsdl it is working well. I mean the test page is opening successfully and I am able to test the service.
    Testing the service from admin console is fine. Now I want to use this BPEL process service in another BPEL process. So, when I am piciking this service wsdl in JDeveloper it is throwing me the same error and I am unable to go ahead.
    Can anyone please tell me whetherI have to set property in the admin server console so that it always take local host in all the wsdl urls and solve my problem.
    Thank you,
    KSN Pavan.

    Hi All,
    My problem has got solved with the help of my colleagues. Actually the problem was that the host name KSNPavan-PC is not there in the C:\Windows\System32\Drivers\etc\hosts file. I Added the host name in the file with the IP same as that of local host and everything isworking well now.
    Thank you,
    KSN Pavan

  • Either the WSDL URL is invalid or the WSDL file is not valid or incorrect.

    Hi ,
    i deployed one bpel process in weblogic.
    when i am click on test below is error is coming. ( its on oracle soa 11)
    below is coming for all the process. previously it is working fine.
    Either the WSDL URL is invalid or the WSDL file is not valid or incorrect. - WSDLException: faultCode=OTHER_ERROR: Failed to read WSDL from http://xxxx:8001/soa-infra/services/default/ReadJMS/readtraxjms_client_ep?WSDL: HTTP connection error code is 503
    Please help me how it is resolved.
    Regards
    jan

    Hi Jan,
    We had the same issue in 11.1.1.3 and we used to restart the server to fix it. Hopefully before going to PROD we upgraded to 11.1.1.5 and next time we saw this issue was only when there was some problem with the OHS (it was down etc.).
    Which version you're on?
    Regards,
    Neeraj Sehgal

  • "Can't open file - not a valid pdf"

    Hi,
    This seems to have been asked before but I can't find an answer!!
    I have a small app that i use for work which essentially just links to pdfs stored on a wordpress site
    All has been working well until recently when android phones can no longer open the files - they get a "can't open file - not a valid pdf file" message
    It seems to happen with many but not all the files. Some examples of problematic ones are:
    http://uhbsosguidelines.files.wordpress.com/2014/02/transfusionmajorhaemorrhagecompressed. pdf
    http://uhbsosguidelines.files.wordpress.com/2014/02/aagbi_la_toxicitycompress.pdf
    http://uhbsosguidelines.files.wordpress.com/2015/01/anaphylaxis-under-anaesthesiaupdated02 14compresresave.pdf
    Oddly, it seems only to be a problem when trying to open directly from the link in the app into adobe reader. If you download the file onto the phone THEN open it in Reader it works fine!
    As I say, this seems to be a recent problem - has been working perfectly up until now.
    I'd really appreciate it if you have any thoughts / suggestions - I don't want to have to ask all the users to install a different PDF reader app!

    Thanks for reporting the issue. We have been able to reproduce it at our end and shall let you know when this gets fixed in one of the future releases.
    Thanks,
    Adobe Reader Team

  • Blackberry Desktop Software won't install on PC "Installation files cannot be validated."

    Blackberry Desktop Software won’t install on PC “Installation files cannot be validated."  KB article 28396 couldn’t get past # 4 because no digital signatures tab.  Removed desktop software initially because it would not update.
    Mark

    I have the same problem, "Torch" 
    Acer,Windows XP
    Blackberry Desktop will not install
    RE; Cannot Vaidate
    ....Scanned internet, unable to find correct Formula to do so

  • PGP Decryption Error (File is no valid PGP Message)

    Hi, I'm encountering an error while decrypting a pgp file.  Error is MP: exception caught with cause com.sap.aii.af.lib.mp.module.ModuleException: File is no valid PGP Message, could not apply decryption.
    I have tested decrypting the file using an external tool and was able to decrypt it but not in PI.  Below is my configs in sender commChannel (Note: no file content conversion is involved).  Any ideas on how to resolve this? Thank you.

    Hi Sarah, thanks for the response. I tried arranging the sequence as you've suggested but once saved, it will re-arrange to the old order as below:
    keyRootPath
    ownPrivateKey
    partnerPublicKey
    pwdOwnPrivateKey
    With regards to running XPI Inspector Tool, i will install it first.
    For the meantime, are there other suggestions?
    Thank you.

  • The setting ExternalProxy in the Web.Config file was not valid.

    Since installing Exchange 2010 SP1 (Upgrade from RTM) I get this in the event viewer.
    The setting ExternalProxy in the Web.Config file was not valid. The previous value was null and has been changed to .
    Any ideas what to check?

    I'm also getting a number of these errors on Exchange 2010 SP1 RU1, the settings that I get notified include (the values have been changed to a number of diferent values):
    ExternalProxy
    BootstrapMailDeliveryDelay
    MobileUpdateInformationURL
    BootstrapCABForWM61HostingURL
    FullServerVersion
    ADCacheMaxOrgCount
    ADCacheExpirationTimeout
    MaxDocumentDataSize
    MaxDocumentLibrarySearchResults
    MaxGALSearchResults
    BadItemEmailToText
    BadItemIncludeEmailToText
    BadItemIncludeStackTrace
    MaxClientSentBadItems
    MailboxSearchTimeoutNoContentIndexing
    MailboxSearchTimeout
    MaxMailboxSearchResults
    MaxRequestsQueued
    MaxWorkerThreadsPerProc
    MaxCollectionsToLog
    ProxyConnectionPoolConnectionLimit
    ProxyHandlerShortTimeout
    ProxyHandlerLongTimeout
    BackOffErrorWindow
    BackOffTimeOut
    BackOffThreshold
    ProxyVirtualDirectory
    BlockLegacyMailboxes
    BlockNewMailboxes
    SchemaValidate
    SchemaDirectory
    SyncLogDirectory
    SyncLogEnabled
    DisableCaching
    DeviceClassCacheADCleanupInterval
    DeviceClassPerOrgMaxADCount
    DeviceClassCachePerOrgRefreshInterval
    DeviceClassCacheMaxADUploadCount
    DeviceClassCacheMaxStartDelay
    MaxWindowSize
    MaxRetrievedItems
    EventQueuePollingInterval
    ADCacheRefreshInterval
    MaxSizeOfMailboxLog
    NumOfQueuedMailboxLogEntries
    MaxNumOfFolders
    Can these be resolved in a similar manner. Some additional information would be great (as sjoegarrett I can also ignore them, but would prefer if these could be eliminated).

  • How to change the Rule file Pointing Automatically?

    Guys,
    Is there any automated way to change the rule file pointing for any application \ DB.. If so, can anyone ellobrate it briefly.....
    Regards
    Srini

    Do you mean you want to use a dimension/data rule that you created in one database and use it in another? Or do you mean you want to reassociate the rule with its new database?
    The former is easy -- copy (or not, the rule can be local) the rule to the new location and use MaxL/Esscmd to load data/dimensions.
    If you mean the latter, I don't know of a way to do that -- typically copying a rule file would only occur when the dimensionality is the same.
    Or do you mean something completely different?
    Regards,
    Cameron Lackpour

  • RD Client and RDWeb 2012 - RDP file is not valid when run from chrome browser on Android

    After signing into the RDWeb using Android Chrome, I see the published remoteapp.  If I click to
    run remoteapp, it tries to open the RDP file with the installed RD Client but I got this error "Import Error - The RDP file is not valid.  Notify your network administrator."
    I have google about this error. One of the forum suggest to use RD client remote resources tab to access the apps but in our environment our user want to use their
    own web browser to access the apps. Is there any way we can solve this issue?.

    Hi,
    I’m afraid that we have to configure Remote Resource.
    Thanks for your understanding.
    Jeremy Wu
    TechNet Community Support

  • HT2486 The selected file does not appear to be a valid comma separated values (csv) file or a valid tab delimited file. Choose a different file.

    The selected file does not appear to be a valid comma separated values (csv) file or a valid tab delimited file. Choose a different file.

    I guess your question is, "what's wrong with the file?"
    You're going to have to figure that out yourself, as we cannot see the file.
    Importing into Address book requires either a tab-delimited or a comma-delimited file. You can export out of most spreadsheets into a csv file. However, you need to make sure you clean up the file first.  If you have a field that has commas in the field, they will create new fields at the comma. So, some lines will have more fields than the others, causing issues like the error you saw.

  • File Not a Valid MPEG ERROR # 20402

    I am trying to burn a demo reel DVD and whenever I go to burn it I get a error that says DVD ERROR FILE NOT A VALID MPEG ERROR [20404]. I removed a couple of the files that could possibly be suspect for being corrupted but I still get the error. By subtracting the amount of mega bytes still to burn from the amount of megs on the DVD I thought I had narrowed it down to just 2 of the videos. But alas no such luck. Is it possible that in the building of the motion menus it somehow didn't build them right? Its always towards the end of the disk when it decides to automatically cancel the build.

    Hi Guys,
    I've been using Encore for a few years, using AME to transcode all my Premiere Pro timelines and suddenly I've had a week of transcoding problems with Encore (CS5.1) saying everything from, I'm using the wrong aspect ratio to not a valid mpeg file. It was something different each time I fixed the previous problem (without it being a problem in the first place).
    After reading all your helpful tips throughout the different forums and trying your suggestions, I have solved my problem. Thought I would post this to hopefully help some of you.
    I simply let Encore transcode my timeline from Premiere Pro and my motion menus from After Effects (all assets in other words) making sure all are set to automatic. You can imagine how surprised I was when the disc popped out with the 100% complete message.
    Thanks for all your posts, hope this can help others.
    Wayne Le Compte.
    Loud Films.
    Loud Graphic Design.

  • Read a file and maintain a file pointer?

    Hi,
    I need to read a file which has about 1000 records(approx).I need to read 10 records from the beginning of the file and then give the 10 records to a different java process and then continue extracting records for every 10.So how do I save the filepointer and then continue read from the 11th record and then 21st record and so on?
    Remember I don't know the total number of records in the file,but know where exactly I have to extract,I mean the trailer info.
    also, Is there a way to store a file pointer for a particular position in the file and then continue reading the file from the same place by using the saved filepointer?
    any idea?
    also,If I save a filepointer as long value and open the file later using randomaccess file,and seek using this saved long value,will there be any change in the position of the file?will this differ in unix and windows?I mean the file pointer?
    --Robert

    Maybe this will make things clearer. Don't be intimidated, it's not really hardimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Random;
    import java.io.*;
    public class Test extends JFrame {
        static final long RECORD_SIZE = 8;
        RandomAccessFile rf;
        JTextArea jta = new JTextArea();
        JTextField jtf = new JTextField();
        Random r = new Random();
        public Test() {
         try { rf = new RandomAccessFile("rtest.dat", "rw"); }
         catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); System.exit(1); }
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container content = getContentPane();
         // Set up the GUI
         content.add(new JScrollPane(jta), BorderLayout.CENTER);
         jtf.setPreferredSize(new Dimension(100,20));
         content.add(jtf, BorderLayout.NORTH);
         JPanel buttonPanel = new JPanel();
         content.add(buttonPanel, BorderLayout.SOUTH);
         JButton add10 = new JButton("Add 10");
         buttonPanel.add(add10);
         add10.addActionListener(new ActionListener() {   // Add 10 listener
             public void actionPerformed(ActionEvent ae) {
              try {
                  rf.seek(rf.length());                // seek to end
                  for(int i = 0; i < 10; i++)          // write 10 recs
                       rf.writeDouble(r.nextDouble()*1000000.);
              catch (IOException ioe) { ioe.printStackTrace(); }
              jta.setText("10 records appended");
              showStats();                        // show current statistics
         JButton list10 = new JButton("List Next 10");
         buttonPanel.add(list10);
         list10.addActionListener(new ActionListener() {    // list 10 listener
             public void actionPerformed(ActionEvent ae) {
              jta.setText(null);
              try {
                  for(int i = 0; i < 10; i++) {
                   if (rf.getFilePointer()<rf.length()) {  // if not eof
                       long recNo = rf.getFilePointer()/RECORD_SIZE;
                       jta.append(""+recNo+") "+Double.toString(rf.readDouble())+"\n");
                   } else jta.append("(eof)\n");
              } catch (IOException ioe) { ioe.printStackTrace(); }
              showStats();                        // show current location/size
         JButton random10 = new JButton("List Random 10");
         buttonPanel.add(random10);
         random10.addActionListener(new ActionListener() {   // list 10 random records
             public void actionPerformed(ActionEvent ae) {
              jta.setText(null);
              try {
                  for(int i = 0; i < 10; i++) {
                   // Get a rendom record number
                   int recNo = r.nextInt((int)(rf.getFilePointer()/RECORD_SIZE));
                   // seek to it
                   rf.seek(recNo*RECORD_SIZE);
                   // read record, add to textarea
                   jta.append(""+recNo+") "+Double.toString(rf.readDouble())+"\n");
              } catch (IOException ioe) { ioe.printStackTrace(); }
              showStats();
         buttonPanel.add(random10);
         JButton rewind = new JButton("Rewind");
         buttonPanel.add(rewind);
         rewind.addActionListener(new ActionListener() {  // rewind listener
             public void actionPerformed(ActionEvent ae) {
              jta.setText(null);
              try {
                  rf.seek(0);                     // move to beginning
              } catch (IOException ioe) { ioe.printStackTrace(); }
              jta.setText("Rewound");
              showStats();                    // show size/location
         buttonPanel.add(rewind);
         showStats();
         setSize(600,500);
         show();
        private void showStats() {
         try {
             jtf.setText("Cnt="+(rf.length()/RECORD_SIZE)+
                   ", Cur="+(rf.getFilePointer()/RECORD_SIZE));
         } catch (IOException ioe) { ioe.printStackTrace(); }
        public static void main(String[] args) { new Test(); }
    }

  • Adobe Encore CS4 File is not valid MPEG?

    Hi!
    Today, I opened up my Encore project to make a small change.  I imported new assets and changed the menu to something different and then linked my buttons to a new timeline that then linked to another timeline.
    I planned to create a DVD, but while it was transcoding and error popped up that said "Adobe Encore File is not valid MPEG."
    All of my assets are in MPEG2-DVD format.  The menu (both the original menu and the new one) was a video created in After Effects CS4 and the other assets were created in Premiere Pro CS4.
    Both the menu and video are 720x480.
    Thanks,
    Brittany

    Um, I'm not exactly sure how to find this, but I just right clicked on the video to click properties and this is what I found:
    Menu:
    Data Rate: 6455kbps
    Menu Audio Bit Rate: 1536kbps
    Second Part of Menu: (I have it set up so that it when you click "Play" or "Behind the Scenes" that it looks like the camera zooms into the title on the menu.  This is in a seperate timeline.)
    Data Rate: 6000kbps
    Audio Bit Rate: 1536kbps
    Main Video:
    Data Rate: 7000kbps
    Audio Bit Rate: 1536kbps
    Also, I don't know if this is worth mentioning, but .xmp and .m2v.xmpses files also rendered along with my MPEG2-DVD video.  I guess this is standard but I just thought I should mention it.

Maybe you are looking for

  • Publisher db password change

    Anyone knowing how I can change the databases passwords on the Publisher config files database.content.properties and database.portal.properties ? (Passwords are encrypted there) I have WCI 10.3.0 and Publisher 6.5 Thanks! Val

  • Error while sending the PO to Fax

    Hi Friends, we are sending a PO to the fax. we are getting a error message saying processing routine ENTRY_NEU in program /SMB40/FM06P does not exist. but processing routine exists for the same. Could you please tell me what could be the reason for t

  • Java Script in a Stored Procedure

    I have a stored procedure. I use HTP Pacakge to generate the Page with HTML tags. I need to include a Javascript file in the stored procedure . I donno the path where the JS file resides in the Appserver meaning the context root. Any help in educatin

  • Withholding infotype 210 using check date

    Hi Currently USTAX using Checkdate to determine IT0210 information ,how do we change this to period begindate/end date. example we have an employee who wants to change the excemptios based on apyperiod but system taking check date instead of period b

  • Is there a way to link duplicate objects or artboards so that you can manipulate multiple copies simultaneously?

    Is there a way that I can link copies of an object so that I can manipulate one copy and the others will change also in real time? Maybe with artboards? Wondering if there's a way to make a duplicate instance of an artboard that is 'linked' so it cha