How to create and handle a text file in CVI

Is there any way to create and handle (like...open,write,read,truncate,close)  the .txt file in CVI?

Sure. CVI is a regular C compiler and hence you can use all ANSI C functions. In addition you can use the File I/O functions from the utility library.

Similar Messages

  • How to create and manage the log file

    Hi,
    I want to trace and debug the program process.
    I write the code for creating log file and debugging the process.
    But i am not able get the result.
    please help me how to create and manage the log file.
    Here i post sample program
    package Src;
    import java.io.*;
    import org.apache.log4j.*;
    import java.util.logging.FileHandler;
    public class Mylog
         private static final Logger log = Logger.getLogger("Mylog.class");
         public static void main(String[] args) throws Exception {
         try {
           // Create an appending file handler
            boolean append = true;
            FileHandler handler = new FileHandler("debug.log", append);
            // Add to the desired logger
            Logger logger = Logger.getLogger("com.mycompany");
            System.out.println("after creating log file");     
              catch (IOException e)
                   System.out.println("Sys Err");
            }Please give the your valuable suggesstion... !
    Thanks
    MerlinRoshina

    Just i need to write a single line in log file.

  • How to create a tab-delimited text file?

    Hi,
    I need to create a tab-delimited text file at presentation server getting content from an internal table. My file should also have a header - also tab-delimited. Data for a header is stored in some work area.
    Any ideas how to add tab-delimiter into a text file? Or should I go for a HEX file and use
    CONSTANTS: c_tab TYPE x VALUE '09'.
    and separate my data with this constant instead?
    Any thoughts whould be appreciated.
    TIA
    Ivaylo Mutafchiev

    Hi Ivaylo,
    Refer sample code:
        IF i_final_head[] IS NOT INITIAL.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                = lcl_filename
              filetype                = 'ASC'
              write_field_separator   = 'X'
            TABLES
              data_tab                = i_final_head
            EXCEPTIONS
              file_open_error         = 1
              file_read_error         = 2
              no_batch                = 3
              gui_refuse_filetransfer = 4
              invalid_type            = 5
              no_authority            = 6
              unknown_error           = 7
              bad_data_format         = 8
              header_not_allowed      = 9
              separator_not_allowed   = 10
              header_too_long         = 11
              unknown_dp_error        = 12
              access_denied           = 13
              dp_out_of_memory        = 14
              disk_full               = 15
              dp_timeout              = 16
              OTHERS                  = 17.
          IF sy-subrc <> 0.
            MESSAGE s000 WITH text-031.
            EXIT.
          ENDIF.
        ENDIF.
    Reward points if this helps.
    Manish
    Message was edited by: Manish Kumar

  • How to create and edit a .ini file using java

    Hi All...
    Pls help me in creating and editing an .ini file using java...
    thanks in advance
    Regards,
    sathya

    Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         private static Properties props;
         public static void main(String[] args) throws IOException {
              File file = new File("test.ini");//This is out ini file
              props = new Properties();//Create the properties object
              read(file);//Read the ini file
              //Once we've populated the Properties object. set/add a property using the setProperty() method.
              props.setProperty("testing", "value");
              write(file);//Write to ini file
         public static void read(File file) throws IOException {
              FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
              props.load(fis);//load the ini to the Properties file
              fis.close();//close
         public static void write(File file) throws IOException {
              FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
              props.store(fos, "");//write the Properties object values to our ini file
              fos.close();//close
    }

  • How do I create and display a text file?

    Hello friends,
    I am trying to create a simple unix like operating system with very basic functionality. I have a hard time trying to create a "mktext" file and actually display the contents of the text file with the "cat" command. For example:
    // If I type
    $$ mktext test.txt "We are one"
    $$ Text file is created
    // And if I type
    $$ cat test.txt
    // This line will appear
    $$ "We are one" // Only the contents of the test.txt will display.
    That is what I want to do, but currently stuck. I would appreciate any help and suggestions. Thanks...

    This will do it:
    import java.io.*;
    import java.util.*;
    public class Osys
         BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
    public Osys()
         try
              while(true)
                   System.out.print("$$ ");
                   String s = keyboard.readLine();
                   analize(s);
         catch(Exception e){}
    private void analize(String s)
         if (s.trim().equals("")) return;
         StringTokenizer st = new StringTokenizer(s," ");
         if (!st.hasMoreTokens()) return;
         String s1 = st.nextToken();
         if (s1.equals("cat"))
              if (st.hasMoreTokens()) readIt(st.nextToken().trim());
              System.out.println("");  
              return;
         if (s1.equals("mktext"))
              if (st.hasMoreTokens()) writeIt(st.nextToken().trim(),s);
              System.out.println("");
              return;
    // write
    private void writeIt(String file, String line)
         BufferedWriter writer;
         StringTokenizer st = new StringTokenizer(line,"\"");
         if (st.countTokens() != 2) return;
         st.nextToken();
         try
              writer  = new BufferedWriter(new FileWriter(file));
                 writer.write(st.nextToken()); 
              writer.close();
              System.out.println("$$ Text file is created");  
         catch (IOException e)
               System.out.println(""+e);  
    // read
    private void readIt(String file)
         BufferedReader reader = null;
         String         read   = null;
         try
             reader = new BufferedReader(new FileReader(file));
              while( (read = reader.readLine()) != null)
                  System.out.println("$$ "+read);  
              reader.close();
         catch (IOException e)
               System.out.println(""+e);  
    public static void main(String[] args)
         new Osys();
    }Noah

  • How to create and write in a file

    Hello Gurus,
    I am creating a file based on the date and time and writing into that. But, I am still getting exception error and all. Kindly, please let me know.
    thanks for all the help...j
    Error:-
    C:\Usage\JavaFiles>java filename "abc"
    Exception in thread "main" java.io.FileNotFoundException:Detail09-2003-
    03:28:04.doc (The system cannot find the file specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
    at TowerDetail.main(TowerDetail.java:30)
    Code sample:-
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    public class TowerDetail{
    public static void main (String[] args) throws IOException{
    String userName = "user";
    String passwd = "pwd";
    String con_db = "jdbc:odbc:datasource";
    String ssn = args[0];
    Vector results = new Vector();
    Connection con = null;
    CallableStatement cstmt = null;
    java.util.TimeZone tz = java.util.TimeZone.getTimeZone("EST");
    java.util.Date now = new java.util.Date();
    DateFormat df = new SimpleDateFormat("MM-dd-yyyy-hh:mm:ss");
    df.setTimeZone(tz);
    String result = df.format(now);
    String fileName = "Detail"+result+".doc";
    File inputFile = new File(fileName);
    FileOutputStream fos = new FileOutputStream(inputFile);
    PrintWriter pw = new PrintWriter(fos);
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }catch (Exception e) {
    System.out.println("JDBC Error: "+e.getMessage());
    return;
    try{
    con = DriverManager.getConnection(con_db, userName, passwd);
    cstmt = con.prepareCall("{call dbo.sp_usage_detail(?)}");
    cstmt.setString(1, ssn.trim());
    ResultSet rs = cstmt.executeQuery();
    pw.println("Report "+result);
    pw.println("------------------------------------------------------------------------------------
    while(rs.next()){
    .... write in the file...
    pw.println("------------------------------------------------------------------------------------
    pw.close();
    System.out.println("Your file Detail"+result+".doc is ready!!!");
    cstmt.close();
    con.close();
    }catch(SQLException ex){
    System.out.println("SQLException: ");
    System.out.println(ex.getMessage());
    }catch(NullPointerException e){
    System.out.println("Null Pointer Exception: ");
    System.out.println(e.getMessage());

    Now, I got out of the command prompt and reentered. I didn't set any classpath or anything. I have created a subdir \archive in the C:\ and writing an output file [DetailTower.....doc")into that.
    The DetailTower.class is in C:\Detail\ProjectClass dirctory.
    Now at,
    C:\Detail\ProjectClass\java -classpath . DetailTower "abc"
    I am getting this error:-
    C:\Detail\ProjectClass>java -classpath . DetailTower "999999"
    Exception in thread "main" java.io.FileNotFoundException: c:\archive\DetailTower09-10-2003-06:23:40.doc (The system cannot find the file specified)at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
            at Detail.main(DetailTower.java:32)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to create spaces in a text file

    Hi forum
               i am creating a text file with the GUI_DOWNLOAD function, my problem is that i need to create some lines with spaces at the end of the line. But i can´t, i had concatenate spaces and i have created structures but in the file doesn´t appear that spaces to the end of the line. example
    -  line
      abcdefghij
    - i need
      abcdefghij******************
    = space
    tghnks
    Josue

    Thnks Pawan, the correct code to append spaces to the end of line for save in a file is, this is an example:
       <b>DATA: space_character type c.</b>
       DATA: s_var1 type c(10).
    *  Init the space character
       <b>space_character  = cl_abap_char_utilities=>minchar .</b>
       s_var1 = '123'.
    *   we need seven spaces more to complete the length of s_var1, then :
    * We need to concatenate into field
    DO 7 TIMES.
        <b>CONCATENATE s_var1 space_character INTO s_var1.</b>
    ENDDO.
    * Move to the internal table for save the text in a file
    MOVE s_var1 TO t_out-line.
    APPEND t_out.
    * Finally we call the GUI_DOWNLOAD function
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fullpath
          filetype                        = 'ASC'
        TABLES
          data_tab                        = t_out
        EXCEPTIONS
          file_write_error                = 1
          no_batch                        = 2
          gui_refuse_filetransfer         = 3
          invalid_type                    = 4
          no_authority                    = 5
          unknown_error                   = 6
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    And it´s all... looks easy but many partner doesn`t know
    Josué
    Code Formatted by: Alvaro Tejada Galindo on Jan 18, 2010 3:34 PM

  • How to create a mapping with text file as my target

    I need to create a mapping with source as a table and target as a text file.
    I am using OWB 10g R2. with database Oracle10g.
    Any one can help me to create a mapping with a text file as target.

    Hi,
    just create a File-Location and File-definition and use this file-operator as target object inside your mapping.
    Regards jwehner

  • How to attach and email a text file using UTL_MAIL.SEND_ATTACH_VARCHAR2

    Hi im trying to attach a text file 'sample.txt' located in '\Test_Loc\New_Folder'
    Here is my code and my OS is Solaris and im using 10g R2
    CREATE OR REPLACE
    procedure test_v2 as
    Begin
    UTL_MAIL.SEND_ATTACH_VARCHAR2(
    sender => '[email protected]',
    recipients => '[email protected]',
    cc => null,
    bcc => NULL,
    subject => 'RE: Testing Attachment',
    message => 'TEST',
    mime_type => 'text/plain; charset=us-ascii',
    priority => 1,
    attachment =>'\Test_Loc\New_Folder\sample.txt',
    att_inline => TRUE,
    att_mime_type => 'application/octet' ,
    att_filename => 'demo.txt'
    end;
    Where am i going wrong? Please help me out
    Regards
    Vibhuti

    Hi,
    i can´t belive that no one is helping you out until now.
    If you found a Solution, let me know.
    I´m in search of the same Problem...
    Regards
    Lone

  • How to create printable (PDF?) text file in PSE 7

    Using slide show format it is possible to create a text file for use in the slide show. Is it possible to print that file (Slide)? How?

    You can output the slideshow as PDF also for publishing purpose. Here is the help link on how to do the same
    http://help.adobe.com/en_US/elementsorganizer/using/WS8346320B-3F64-46f6-AE4B-9FF4D934DB36 _WIN.html#WS28EB9511-B6BE-4abd-980B-59A6DDC877A6_WIN
    Also you can use Share->PDF Slideshow option to create pdf slideshow for your images.
    Hope it helps.
    Thanks,
    Gaurav

  • How to create and use library JAR files with command-line tools?

    Development Tools -> General Questions:
    I am trying to figure out how to put utility classes into JAR files and then compile and run applications against those JAR files using the command-line javac, jar, and java tools. I am using jdk1.7.0_17 on Debian GNU/Linux 6.0.7.
    I have posted a simple example with one utility class, one console application class, and a Makefile:
    http://holgerdanske.com/users/dpchrist/java/examples/jar-20130520-2134.tar.gz
    Here is a console session:
    2013-05-20 21:39:01 dpchrist@desktop ~/sandbox/java/jar
    $ cat src/com/example/util/Hello.java
    package com.example.util;
    public class Hello {
        public static void hello(String arg) {
         System.out.println("hello, " + arg);
    2013-05-20 21:39:12 dpchrist@desktop ~/sandbox/java/jar
    $ cat src/com/example/hello/HelloConsole.java
    package com.example.hello;
    import static com.example.util.Hello.hello;
    public class HelloConsole {
        public static void main(String [] args) {
         hello("world!");
    2013-05-20 21:39:21 dpchrist@desktop ~/sandbox/java/jar
    $ make
    rm -f hello
    find . -name '*.class' -delete
    javac src/com/example/util/Hello.java
    javac -cp src src/com/example/hello/HelloConsole.java
    echo "java -cp src com.example.hello.HelloConsole" > hello
    chmod +x hello
    2013-05-20 21:39:28 dpchrist@desktop ~/sandbox/java/jar
    $ ./hello
    hello, world!I believe I am looking for:
    1. Command-line invocation of "jar" to put the utility class bytecode file (Hello.class) into a JAR?
    2. Command-line invocation of "javac" to compile the application (HelloConsole.java) against the JAR file?
    3. Command-line invocation of "java" to run the application (HelloConsole.class) against the JAR file?
    I already know how t compile the utility class file.
    Any suggestions?
    TIA,
    David

    I finally figured it out:
    1. All name spaces must match -- identifiers, packages, file system, JAR contents, etc..
    2. Tools must be invoked from specific working directories with specific option arguments, all according to the project name space.
    My key discovery was that if the code says
    import com.example.util.Hello;then the JAR must contain
    com/example/util/Hello.classand I must invoke the compiler and interpreter with an -classpath argument that is the full path to the JAR file
    -classpath ext/com/example/util.jarThe code is here:
    http://holgerdanske.com/users/dpchrist/java/examples/jar-20130525-1301.tar.gz
    Here is a console session that demonstrates building and running the code two ways:
    1. Compiling the utility class into bytecode, compiling the application class against the utility bytecode, and running the application bytecode against the utility bytecode.
    2. Putting the (previously compiled) utility bytecode into a JAR and running the application bytecode against the JAR. (Note that recompiling the application against the JAR was unnecessary.)
    (If you don't know Make, understand that the working directory is reset to the initial working directory prior to each and every command issued by Make):
    2013-05-25 14:02:47 dpchrist@desktop ~/sandbox/java/jar
    $ cat apps/com/example/hello/Console.java
    package com.example.hello;
    import com.example.util.Hello;
    public class Console {
        public static void main(String [] args) {
         Hello.hello("world!");
    2013-05-25 14:02:55 dpchrist@desktop ~/sandbox/java/jar
    $ cat libs/com/example/util/Hello.java
    package com.example.util;
    public class Hello {
        public static void hello(String arg) {
         System.out.println("hello, " + arg);
    2013-05-25 14:03:03 dpchrist@desktop ~/sandbox/java/jar
    $ make
    rm -rf bin ext obj
    mkdir obj
    cd libs; javac -d ../obj com/example/util/Hello.java
    mkdir bin
    cd apps; javac -d ../bin -cp ../obj com/example/hello/Console.java
    cd bin; java -cp .:../obj com.example.hello.Console
    hello, world!
    mkdir -p ext/com/example
    cd obj; jar cvf ../ext/com/example/util.jar com/example/util/Hello.class
    added manifest
    adding: com/example/util/Hello.class(in = 566) (out= 357)(deflated 36%)
    cd bin; java -cp .:../ext/com/example/util.jar com.example.hello.Console
    hello, world!
    2013-05-25 14:03:11 dpchrist@desktop ~/sandbox/java/jar
    $ tree -I CVS .
    |-- Makefile
    |-- apps
    |   `-- com
    |       `-- example
    |           `-- hello
    |               `-- Console.java
    |-- bin
    |   `-- com
    |       `-- example
    |           `-- hello
    |               `-- Console.class
    |-- ext
    |   `-- com
    |       `-- example
    |           `-- util.jar
    |-- libs
    |   `-- com
    |       `-- example
    |           `-- util
    |               `-- Hello.java
    `-- obj
        `-- com
            `-- example
                `-- util
                    `-- Hello.class
    19 directories, 6 filesHTH,
    David

  • How to create and handle sharepoint custom list with more than 300 columns?

    Hi,
    I have requirement for our project where in the input form is having around 320 columns in it.below are the columns and data types.
    Single line of text-180
    Yes or No Radio button -95
    Date time control-35
    Checkbox-10
    I have checked the sharepoint boundry and limits for columns and data types.
    https://technet.microsoft.com/en-us/library/cc262787.aspx
    But how can we handle a sharepoint list with these many large number columns.
    Is it safe to create all columns in a single list?
    How it will impact the performance?
    What is the other approach acheive this requirement?
    Any help would be appreciated.
    Regards,
    Poovi

    Hi,
    According to your description, my understanding is that you want to know if it has some performance issue and limitation when create large number column in a list.
    When creating columns in the list , you can still create all 320 columns in the list. But when retrieve the items in a view, then there is a list view threshold limit which causes the performance issue, see the link below:
    Sharepoint list column limit
    To handling the large number columns, I suggest you can distinguish the column with business logic to create in different list, it will be clear to display the logic relationship.
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to create and attach a pdf file to an email

    I am looking into the feasibility of using email system to send indentical notices along with data attachments to hundreds of companies simultaneously. Each data attachment is corresponding to its own company email.
    Please advise how can I create this file. What tool(s) do I need?
    Thanks in advance for your assistance.
    ML

    user627993,
    First thing is that this forum is for OTN community feedback and suggestions as the forum header says. Second, you have not provided any background of scenario like platform, tools, business case etc, so its impossible to suggest where to post.
    You can go to forum home page
    http://forums.oracle.com/forums/categoryHome.jspa?categoryID=84 and check which one is suitable for your case.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to create and modify an XML file from an Oracle Form

    I would like to build an Oracle Form to maintain a small XML file in the file system (i.e. Not in Oracle database but in the operating system).
    I would like the Form to display existing values from the XML file and the user can update and save content back to the XML file.
    Can any one tell me how this can be done? Thanks.

    Does Forms 9i provide any XML Parser Functions?
    Can I insert the XML file into a table column by inserting XML using the XSU Front End rather than using TEXT_IO to maintain the XML file directly?
    Can I use XSU PL/SQL API in Forms to retrieve and modify XML values?
    Any help is appreciated.

  • How to create and deploy a war file on wls using the console

              my question is how to deploy the simpleSession.jsp example in the weblogic/samples/examples/jsp/
              dir examples as a war file on wls cluster what are the steps to do so.. thanks
              in advance
              

    [att1.html]
              

Maybe you are looking for