Insert a line into the beginning of a file without overwriting data

I would like to dynamically alter/add new headers to a csv file as needed. The code I have below overwrites the previously written data an amount equal to each new header added each time I call the vi below. Any suggestions on how to do this without reading in the file each time? I want to avoid the processing time of reading in the file between processing new data.
Thanks!
Attachments:
R900 - Log Data Stream to File.vi ‏22 KB

Yes, but you can still write everytime, you dont need to read the file back.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV

Similar Messages

  • Append a line at the beginning of a file via UTL_FILE

    Hello,
    is there a way to append a line to the beginning of a file instead of at the end of an existing file via UTL_FILE?
    Thanks in advance,
    Geert

    No, you would have to create a new file.

  • Need to create procedure for insert tax line into ra_interface_lines_all

    Dear
    I need to create a procedure for insert a tax line into ra_interface_lines_all against the line type "LINE".
    after inserting the record i will run the auto invoice program to see the changes. kindly share how i can achieve through procedure.
    scenario:-
    after order dispatch workflow back ground run and data populated in ra_interface_lines_all where interface line id is null there i need to insert tax line against multiple orders.
    I know the join. when line type = 'LINE'  then tax line must have link_to_line_id of the line type line. my question is this when order number change how i can insert tax line against the line type line.
    regards,
    Fs
    Message was edited by: 832296

    Dear
    I need to create a procedure for insert a tax line into ra_interface_lines_all against the line type "LINE".
    after inserting the record i will run the auto invoice program to see the changes. kindly share how i can achieve through procedure.
    scenario:-
    after order dispatch workflow back ground run and data populated in ra_interface_lines_all where interface line id is null there i need to insert tax line against multiple orders.
    I know the join. when line type = 'LINE'  then tax line must have link_to_line_id of the line type line. my question is this when order number change how i can insert tax line against the line type line.
    regards,
    Fs
    Message was edited by: 832296

  • How to insert blank lines in the ALV output.

    Hi Friends,
    Could any body help me out How to insert blank lines in the ALV output.?? Any Code pls...
    Thank you,
    Vikram.C

    hi vikram
    do like this
    In the fieldcatalog table all the fields should be in editable mode
    ie lw_fcat-edit = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = lv_layout
    it_fieldcat = lt_fcat[]
    i_save = 'A'
    is_variant = lv_variant
    TABLES
    t_outtab = lt_license[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_data
    *& Form user_command
    FORM user_command USING r_ucomm TYPE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN 'ADD'. "
    data: lv_ind type i.
    data: lv_line type i.
    describe table lt_license lines lv_line.
    loop at lt_license into lw_license.
    lv_ind = sy-tabix.
    if lv_ind = lv_line.
    append initial line to lt_license.
    endif.
    endloop.
    ENDCASE.
    ENDFORM. "user_command
    reward points if useful
    Rohan

  • Question on sort behavior when inserting ACL lines into existing ACL

    Hello,
    I have a request / need to insert lines into existing ACLs (some standard, some extended) and I need to control where they are added (we want some to go to the top, some in the middle, some second from bottom).
    I'm trying to understand / follow how ACL lines are added / sorted.  I have three examples of different configs (standard ACL) where someone inserts lines into the existing ACL. 
    The problem is, it does not follow the guidelines I've found on cisco.com - i.e. using Sequence #s if specified, they don't all get added to the bottom, etc. 
    How can I determine how a line added to an existing ACL will behave? 
    I've added new ACLs, and as far as I can tell, for those examples, it will follow the sequence #s for both standard and extended acls, but not at all for these examples. 
    thanks!
    -Chris

    There's a tutorial on creating client-side XSLT pages here: http://www.adobe.com/devnet/dreamweaver/articles/display_xml_data.html.
    I'm not sure if it will work with a template. Unfortunately, XSLT is a mind-bender that tends to do serious damage to the average brain. That's why most people use server-side technology to deal with XML.
    You mention that XSL isn't supported on your PHP server. What about SimpleXML? That's standard in all PHP 5 installations. Don't say your server is still running PHP 4. Support for PHP 4 was dropped nearly two years ago.

  • SCCM 2012: Failed to insert OSD binaries into the WIM file' error when you create a MDT Task Sequence

    Hi,
    When I try to import the MDT boot image X86, I get the following error:
    Started processing.
    Creating boot image.
    Copying WIM file.
    Mounting WIM file.
    WIM file mounted.
    Setting Windows PE system root.
    Set Windows PE system root.
    Set Windows PE scratch space.
    Adding standard components.
    Adding component: winpe-mdac
    Adding extra content from: C:\Users\ADMINI~1.afO\AppData\Local\Temp\3\sfup2yp2.0rt
    Unmounting WIM.
    Copying WIM to the package source directory.
    Creating boot image package.
    Error while importing Microsoft Deployment Toolkit Task Sequence.
    Failed to insert OSD binaries into the WIM file
    Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryException: The SMS Provider reported an error. ---> System.Management.ManagementException: Generic failure
       at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
       at System.Management.ManagementObject.Put(PutOptions options)
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put(ReportProgress progressReport)
       --- End of inner exception stack trace ---
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put(ReportProgress progressReport)
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put()
       at Microsoft.BDD.Wizards.SCCM_ImportTaskSequenceTask.DoWork(SmsPageData smspageData, Dictionary`2 data)
    Note: previous x86 image was deleted some time ago.
    Please advise.
    J.
    Jan Hoedt

    This is the error in smsprov.log
    *********** WBEM Missing property TransformAnalysisDate    SMS Provider    16/04/2014 15:11:00    7856 (0x1EB0)
    ************ WBEM Missing property TransformReadiness    SMS Provider    16/04/2014 15:11:00    7856 (0x1EB0)
    Image language ID 1033 and en-US    SMS Provider    16/04/2014 15:11:00    7856 (0x1EB0)
    Image language ID 1033 and en-US    SMS Provider    16/04/2014 15:11:10    7856 (0x1EB0)
    Image language ID 1033 and en-US    SMS Provider    16/04/2014 15:11:19    7856 (0x1EB0)
    ERROR> Error -1073741502 returned to execute the command line: "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.exe" /Image:"C:\windows\TEMP\BootImages\{8AEF81AB-4B11-4AEF-96D3-E90D84D3DA94}\mount" /Add-Package
    /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-Scripting.cab"    SMS Provider    16/04/2014 15:11:19    7856 (0x1EB0)
    Failed to install required components into the boot image C:\windows\TEMP\BootImages\{8AEF81AB-4B11-4AEF-96D3-E90D84D3DA94}\mount    SMS Provider    16/04/2014 15:11:19    7856 (0x1EB0)
    *~*~e:\nts_sccm_release\sms\siteserver\sdk_provider\smsprov\sspbootimagepackage.cpp(3766) : Failed to insert OSD binaries into the WIM file~*~*    SMS Provider    16/04/2014 15:11:36    7856 (0x1EB0)
    *~*~Failed to insert OSD binaries into the WIM file ~*~*    SMS Provider    16/04/2014 15:11:36    7856 (0x1EB0)
    Auditing: User FAC\administrator called an audited method of an instance of class SMS_BootImagePackage.    SMS Provider    16/04/2014 15:11:36    7856 (0x1EB0)
    CExtUserContext::LeaveThread : Releasing IWbemContextPtr=9281008    SMS Provider    16/04/2014 15:11:36    7856 (0x1EB0)
    Jan Hoedt

  • How to remove characters/lines from the beginning of an InputStream

    Hi,
    I have a program which receives several InputStreams. From each of these streams I have to remove 2 lines from the beginning. After the lines are removed, all the streams are combined to one with SequenceInputStream and read in one chunk. Is there an easy/simple way of doing this?
    One option I thought would be to read the char by char until 2 end of line chars have been detected and then read the rest of the data to a buffer. And the create a ByteArrayInputStream out of this buffer. Problem with this approach is, that the amount of data can be large, so putting all the data in to memory might cause problems.
    Another option is to use BufferredInputStream and use the readline() method twice to get rid of the lines that are not needed. After this I would write the data to some output stream, which is then converted back to input stream. Propably would work, but sound too much of work for a simple thing like this. There has to be better way.
    To make it simple, what I need is a method that looks like the following, or something similar
    *  Removes n number of lines from the beginning of a InputStream.
    *  @param is InputStream where the lines are removed
    *  @param numberOfLines int value to indicate how many lines whould be removed
    *  @return InputStream where lines have been removed.
    public InputStream removeLines(InputStream is, numberOfLines);Thanks.

    Here's the code, feel free to use it. Comments are also welcome.
    public InputStream removeLinesFromTheBeginning(InputStream is, int numberOfLines) throws IOException
              char c = 'c';
              int i = 0;
              for(int n = 0 ; n < numberOfLines ; n++)
                   do
                        c = (char)is.read();
                        System.out.print(c);
                        if(c == (char)-1)     // end of stream reached before any newline characters were found.
                             return null;
                        i++;
                   while(c != '\n');
                   System.out.println();
                   System.out.println("Characters removed:" + i);
                   System.out.println("n: " + n);
                   i = 0;
              return is;
         }Edited by: dave_spaghetti on Jun 16, 2009 5:42 AM
    Fixed a bug.

  • Add a new line at the begining of a string in a Xquery ALSB3.0

    Has anyone figured out how to Add a new line at the begining of a string in a Xquery in ALSB3.0?
    Thanks for your Help.

    I believe this is related to BI Publisher. Any comments would be greatly appreciated.
    Thanks,
    Sinan

  • Insert french characters into the database

    Hi,
    My user requirement is to insert french characters into the db. However he has set as per my suggestion of altering session alter session set nls_language='french' he can't insert french characters. Is this using alter session helps to retrieve only the outputs in french language or to insert too?
    Please help.
    Version : oracle 8i
    nls_parameters at database level:
    SQL> select * from nls_database_parameters;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET US7ASCII
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_NCHAR_CHARACTERSET US7ASCII
    NLS_RDBMS_VERSION 8.1.7.0.0

    Your database character set is US7ASCII : you can only insert ASCII characters which is OK for most French characters but not all. This cannot work for:
    àéèùçChanging NLS_LANGUAGE won't help. You need to change database character set to WE8MSWIN1252 for example. This should be easy in your case because US7ASCII is a binary subset of many others characters set. Please read http://docs.oracle.com/cd/A87860_01/doc/server.817/a76966/ch3.htm#47136

  • Insert Multiple rows into the table from that table data

    Hi All,
    I have a requirement like to insert mulitple rows into the table from that table data only(I need to replicate the data).
    In this table primary key is composite primary key with all foreign keys.primary key also including the Date foreign key.I need to change that date at the of insertion.
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    VALUES
    (SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510
    But it is giving the error like missing Expression.
    Could anyone please help to me.
    Thanks and Regards
    Swetha.

    You can have either VALUES or SELECT not both
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510;

  • How to insert an hiperlink into the header of a discoverer report?

    Hello,
    I would like to insert an hiperlink into the header of a discoverer report. Any ideas?
    Thank you.

    Hi,
    Me too also wants to know regarding this,
    Mr Rod any inputs?
    Thanks
    Himanshu Tiwari

  • Is it true that Pages cannot insert a page into the middle of a document?

    Is it true that Pages cannot insert a page into the middle of a document?
    I have tried this many times using different techniques and it just refuses to do it. Can anyone help?

    To see how Pages works:
    Menu > View > Page Thumbnails
    When you click on the thumbnails each Section is outlined in yellow.
    Click where you want a new page > Menu > Insert > Section Break
    But then to have a new page all you need to do is add content to fill the page or Insert > Page Break to force the insertion point over onto a new page.
    Peter

  • Why does my Apple Mail insert old messages into the body of new emails?

    Why does my Apple Mail insert old messages into the body of new emails? The correct sender's name will appear in the "From" column, but an old message from a different sender in the body. This happens randomly. I have an iMac OSX 10.6.8. I recently had the hard drive cleaned, but Apple Mail seemed to be running fine when I set it up again. Could this be a virus? What should I do about it? Thanks for any insights!

    Thanks.  While you were replying to my question, I went into notifications and figured
    it out.  Appreciate the quick response!

  • Appending data to the beginning of a file

    How do you write data to the first line of a file without overwriting the data which is already present?
    Data before:
    888826759 100011021
    888826767 100011026
    888826916 100011024
    888826916 100011023
    888826940 100011029
    888826940 100011028
    888857389 100011020
    888871480 100011029
    What I want data to look like after:
    ABC
    888826759 100011021
    888826767 100011026
    888826916 100011024
    888826916 100011023
    888826940 100011029
    888826940 100011028
    888857389 100011020
    888871480 100011029
    I'm trying this, but it doesn't work as it overwrites the first piece of data in the file
    file.seek(0);              
    file.writeBytes("ABC");so that the output is:
    ABC826759 100011021
    Edited by: drakester on Oct 12, 2007 10:59 AM

    You might be able to write the file into one of the Collection Lists that maintain order (like LinkedList, but there are others), add the first line, and then rewrite the file from the list. You might also find the Collections methods reverse and rotate could be useful if you add the data at the end of the list.
    You could also create an array and fill the 2nd through last elements with the file lines, insert your data as the first element, then write the file from the array.
    Ther are a number of variations on the above approaches.

  • How would I erase the beginning of a file?

    I want to be able to erase the beginning of a file, while writing to the end...WITHOUT reading the whole file and writing it again because that would be a waste of resourses. Obviously I know that option is available.
    My situation is that I am adding lines to a log file, and I want to remove any entries that are X hours old. Logging a lot of information would mean that every few seconds, an entry is older than X hours and needs to be removed. It doesnt have a set number of lines so I can't just recycle the file by doing something like: if at line number Y, start at line 1 and remember the current line number.
    Adding to the top of the file, pushing the others lines down, and making cuts at the end would also work, but the same situation arises, how do I add to the beginning of the file, without having to copy the entire file to add the entry to the top.
    The reason I don't want to read the whole file is because having to read the whole file and write the whole file when an entry is made is time consuming and wastes CPU and memory, especially when the logs are coming in several lines a second.

    I would think it could easily be done. say you want to erase the first 10 bytes, why cant you just say move the start of the file up 10 bytes. Somewhere in the filesystem the start of the file is stored. I found underlying file copying that claims this in FileChannel's transferTo and transferFrom:
    This method is potentially much more efficient than a simple loop that reads from this channel and writes to the target channel. Many operating systems can transfer bytes directly from the filesystem cache to the target channel without actually copying them.
    If I can't just chop, I'll have to copy quickly at scheduled intervals.
    This is code I ran to test the above quote:
        public static void main(String[] args) throws Exception{
            args = new String[2];
            BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Enter File Name:");
            args[0] = input.readLine();
            System.out.println("Enter test (0-2):");
            args[1] = input.readLine();
            long time = System.currentTimeMillis();
            int version = Integer.parseInt(args[1]);
            switch (version) {
                case 0:
                    BufferedReader in = new BufferedReader(new FileReader(args[0]));
                    PrintWriter out = new PrintWriter(new FileWriter("tempfile.txt"));
                    in.readLine();//skip line.
                    for (String line = in.readLine();line != null;line = in.readLine()) {
                        out.println(line);
                    in.close();
                    out.close();
                    break;
                case 1:
                    RandomAccessFile raf = new RandomAccessFile(args[0],"rw");
                    String line = raf.readLine();
                    long offset = raf.getFilePointer();
                    byte[] b = new byte[1024];
                    int bytes = 1024;
                    long index = 0;
                    System.out.println("index = " + raf.getFilePointer());
                    System.out.println("index = " + line.length());
                    while(bytes == 1024) {
                        bytes = raf.read(b);
                        index = raf.getFilePointer();
                        raf.seek(index - bytes - offset);
                        raf.write(b,0,bytes);
                        raf.seek(index);
                    raf.setLength(raf.length()-offset);
                    raf.close();
                    break;
                case 2:
                    RandomAccessFile raf2 = new RandomAccessFile(args[0],"rw");
                    String line2 = raf2.readLine();
                    long offset2 = raf2.getFilePointer();
                    FileChannel f = raf2.getChannel();
                    FileChannel g = f.position(0);
                    g.transferTo(offset2,raf2.length() - offset2,f);
                    raf2.setLength(raf2.length()-offset2);
                    raf2.close();
                    break;
            System.out.println(System.currentTimeMillis() - time);
        }and had these results
    166MB Log File
    Linux Mandrake 900Mhz
    Case 0 = 32914 ms
    Case 1 (1k byte[]) = 15043 ms
    Case 1 (16k byte[]) = 6988 ms
    Case 1 (1MB byte[] = 6113 ms
    Case 2 = 6188 ms
    :-/ guess this proves that the FileChannel can't chop

Maybe you are looking for

  • Pro*C on Oracle Linux and 11g R2

    Hello everyone I am unable to find Oracle documentation on how to use make and compile and link ProC programs on Oracle Linux and Oracle 11g R2* The Pro*C manuals for 11g R2 refer me to the "operating system specific manuals" for compiling and linkin

  • Cancel/correct line items in delivery

    Hi All, Created order, delivery ang PGI. created billing document and accounting document not cleared. How to correct/cancel the delivery line items- What I know is- cancel billing doc-VF11 and then cancel PGI and change the Delivery items. Please le

  • Formatting by date and price

    Hi I'm having a problem formatting a spreadsheet. My spreadsheet has 10 columns and two of these are renewal date and price.  I need to format the spreadsheet so that any date before 30 September goes red; before 31 October - another colour; before 3

  • Hide RichTextBox controls + title, etc.

    hi all, i'm using the mx:RichTextEditor and i've hidden the controlBar, but is it possible to just get the actual text area, without the title area and the margins outside of the box, etc?

  • 401.2 Error Accessing Report Manager

    I concede defeat on this one.  I've gone through every configuration option I can think of in order to get this working so I am bowing to those who know more than I do! I've got a native installation of SSRS 2008 R2 running on W2K8 R2.  Straightforwa