How to output data to a file in SCC-SG04?
I am using SCC-2345 with SCC-SG04 connected to NI-6221 in Windows 2000 in VC6.
How to output data to a file like data1.dat in VC6 or in Labwindows/CVI?
Hello mwibm,
If you just want to do file input/output in LabWindows/CVI, I would take a look at the Formatting and I/O CVI library or the ANSI File I/O functions. For example, if you just want to write an array of data to a file, I would look at the ArrayToFile function or the fwrite/fputs/fprintf ANSI C functions included in stdio.h. The ANSI C functions will also work in Visual Studio. More information on the LabWindows/CVI File I/O functions can be found in CVI help, and more information on ANSI C functions can be found in CVI Help and online at various websites.
Maybe you could further clarify what problems you are having and what kind of data you want to write to a file.
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter - ni.com/cvinews
Similar Messages
-
How to read data from a file that was formatted by excel?
Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?
http://jakarta.apache.org/poi/hssf/index.html
HSSF stands for Horrible Spreadsheet Format, but it still works! -
Output data to txt file with full length of the field as in database
Hi
I have a problem related to output data I ntxt file on server
for eg
CONCATENATE
wa_sagadr_outtab-seqno
wa_sagadr_outtab-bpext
wa_sagadr_outtab-name_org1
wa_sagadr_outtab-country INTO wa_sagadr_text SEPARATED BY ''.
the output is separated by single space irrespective of database length of the field , I want to display all the lenth of the database field eventhough the remaining space is blank ie if a field is 20 char in dtabase and only filled with 6 char the whole 20 char lenth should be displayed in the output file
ouput as below
required format ie space equvalent to as in database lenght
000001 700006 C4 Plant AMD Export Sdn.Bhd.so on.
my format as coming single space in between only
000001 700006 C4 Plant AMD Export Sdn.Bhd
pls suggestFor this maintain an work area with the fields and structure same as the one which you want.
ten populate the work are and write to file.
concatenate will not work.
e.g.
DATA: begin of wa_sagadr_text,
seqno like wa_sagadr_outtab-seqno,
bpext like wa_sagadr_outtab-bpext,
name_org1 like wa_sagadr_outtab-name_org1,
country like wa_sagadr_outtab-country
end of wa_sagadr_text,
clear wa_sagadr_text.
wa_sagadr_text-seqno = wa_sagadr_outtab-seqno.
wa_sagadr_text-bpext= wa_sagadr_outtab-bpext.
wa_sagadr_text-name_org1 = wa_sagadr_outtab-name_org1.
wa_sagadr_text-country = wa_sagadr_outtab-country INTO wa_sagadr_text.
transfer wa_sagadr_text to outputfile
or write:/ your fields. -
How to share data in cfc files?
I can save shared data (like dsn) in application.cfm so all
the cfm file can read it.
But how to share data in cfc files like application.cfm. I
hear application.cfc,may I use it share data in cfc files?
Do you think if it is ok that application.cfm and
application.cfc exist in the site?
Thanks
Markquote:
Originally posted by:
mark416
I can save shared data (like dsn) in application.cfm so all
the cfm file can read it.
But how to share data in cfc files like application.cfm. I
hear application.cfc,may I use it share data in cfc files?
Do you think if it is ok that application.cfm and
application.cfc exist in the site?
Thanks
Mark
Don't use both. Things like a dsn are best defined in the
onApplicationStart method of an application.cfc. -
How to extract data from XML file with JavaScript
HI All
I am new to this group.
Can anybody help me regarding XML.
I want to know How to extract data from XML file with JavaScript.
And also how to use API for XML
regards
NagarajuThis is a Java forum.
JavaScript is something entirely different than Java, even though the names are similar.
Try another website with forums about JavaScript.
For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3 -
How to write data to text file using external tables
can anybody tell how to write data to text file using external tables concept?
Hi,
Using external table u can load the data in your local table in database,
then using your local db table and UTL_FILE pacakge u can wrrite data to text file
external table
~~~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
UTL_FILE
~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
Message was edited by:
Nicloei W
Message was edited by:
Nicloei W -
How get output generated as csv file by reading by buffered reader and wr
how get output generated as csv file by reading by buffered reader and writer
String file_location = "C\temp\csv.txt");
try {
URL fileURL = getClass().getResource(file_location);
if (fileURL != null){
BufferedReader br = new BufferedReader(new InputStreamReader(fileURL.openStream()));
String s = br.readLine();
while (s != null) {
if (!s.equals ("")) {
System.out.println(s);
s = br.readLine();
br.close();
else {
// error
catch (IOException ex){ex.printStackTrace();}rykk
Message was edited by: a dummy
rykk. -
How to insert data from *.dmp file to oracle 11g using Oracle SQL Develope
hi
i backup my database using PL/SQL developer and made *.dmp file
how to insert data from *.dmp file to oracle 11g using Oracle SQL Developer 2.1.1.64
and how to make *.dmp file from sql*plus ?
thanks in advancePl/Sql developer has a config window, there you choose the exec to do the import/export.
Find it and his home version, it may be exp or expdp, the home version is the version of the client where the exp executable is.
Then use the same version of imp or impdp to execute the import, you do not need to use Oracle SQL Developer 2.1.1.64. If you want to use it, you must have the same version in the oracle home that exp/imp of sql developer use. -
How to read data from multiple files and append in columns in one file
Hi Guys,
I have a problem in appending data from files in different columns. I have attachement has file A and B which I am reading and not able to get data as in file Result.txt. Please comment on how can I do this
Solved!
Go to Solution.
Attachments:
Write to file.vi 13 KB
A.txt.txt 1 KB
B.txt.txt 1 KBYou cannot append columns to an existing file. Since the data is arrange line-by-line as one long linear string in the file, you can only append rows. A new row needs to be interlaced into the original file, shifting everything else. If you want to append rows, you need to build the entire output structure in memory and then write all at once.
(I also don't think you need to set the file positions, it will be remembered from the last write operation.)
Unless the files are gigantic, here's what I would do:
(Also note that some of your rows have an extra tab at the end. If this is normal, you need a little bit more code to strop out empty columns. I include cleaned up files in the attachment. I also would not call them A.txt.txt etc. A plain A.txt is probably sufficient.)
EDIT: It seems Dennis's solution is similar )
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Write to fileMOD.zip 6 KB
MergeColumns.png 6 KB -
Hi all,
As we can get data from .xls, .xlsx file in a dataset. Now i want to read all the entire data from .xltm file.
I also want to get all sheets name from .xltm file. I am using .Net framework 4.5, Visual studio 2012.
Please help me. I am unable to extract it. It is urgent.Hello Kalpna Bindal,
I just investigate this issue and use the following way but it does work:
private void Button_Click(object sender, RoutedEventArgs e)
// initialize connection
OleDbConnection con = new OleDbConnection();
con.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Fruits1.xltm;Extended Properties=\"Excel 12.0 Xml;HDR=YES;\"";
//pass query to Insert values into Excel
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "insert into [Sheet1$] values('')";
cmd.Connection = con;
// EXECUTE QUERY
con.Open();
cmd.ExecuteNonQuery();
con.Close();
I then did a research about this issue and find the following case:
http://stackoverflow.com/questions/22225017/reading-excel-xltm-files-programmatically
To test whether it is possible I use the following code in WPF:
Microsoft.Office.Interop.Excel.Application xltmApp = new Microsoft.Office.Interop.Excel.Application();
xltmApp.Visible = false;
xltmApp.ScreenUpdating = false;
Workbook xltmBook = xltmApp.Workbooks.Open(@"D:\Fruits1.xltm");
Worksheet xlworksheet = xltmBook.Worksheets.get_Item(1);
for (int i = 1; i <= 1; i++)
for(int j=1;j<=1;j++)
string str = (string)(xlworksheet.UsedRange.Cells[i, j] as Microsoft.Office.Interop.Excel.Range).Value;
MessageBox.Show(str);
The result is that I can read this .xltm file and read the firstline without problem.
I would think you can also use this way to work with your .xltm file and output it to your application.
For more details about how to fill to your WPF, common wpf and excel thread will be helpful:
http://www.codearsenal.net/2012/06/c-sharp-read-excel-and-show-in-wpf.html#.URPyfPJJocU
http://www.dotnetcurry.com/showarticle.aspx?ID=988
http://mozouna.com/Blog/2013/03/28/wpf-reading-and-writing-to-excel-file-with-c/
By the way, for WPF case please post on WPF forum instead of C# forum.Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to output data when converting labview vi into matlab mex functions
Hi,
I am a fairly new user to labview and am currently working on labview
7.1. I have created a labview vi which can extract data from ni daq
6070e in real time. The problem is that this code has to be converted
so that it can be used with matlab.in order to do that i am using math
interactive tool kit which converts the labview code into mex files
which can then be used in matlab. Unfortunately i have not been able to
figure out how to output this data so that it can be processed in
matlab easily. i cannot afford any loss of information and all the
output must happen in real time. the o/p must take place after the fft
has been done. i am attaching the vi for convenience.There are 10
broken wires ,and this is the place where i want the o/p to be
generated.
Also do let me know if this vi can be further improved.
Regards
Attachments:
RT_loop2ver4_working.zip 642 KBManuj,
You seem to have misunderstood the way in which LabVIEW processes data. The code that you have produced will run in exactly the same way without the need for the case structure.
The code does not actually run the data from the previous case. It is merely processing data from the previous loop iteration, regardless of the case. If you were to remove the case structure, leaving only one copy of the code intact, and remove the toggle switch you have produced, or used the shift register which, I assure you would have worked, then you will have exactly the same functionality.
I have attached an example that uses the shift register to toggle cases, but also iterates that the case structure is not needed by using the same feedback node (and code) without a toggle switch or case structure.
Hope this helps you optimize your code
Regards
AdamB
Applications Engineer
National Instruments UK
Applications Engineering Team Leader | National Instruments | UK & Ireland
Attachments:
CASE_NO-CASE_Example.vi 24 KB -
How to output to an excel file?
Hi,
I have written a program that gets data from the database and I like to find out how to output the data to an excel file. I have read about similar topic on the discussion board and the solution are for the online application. Mine is a desktop application. The user can specify what the destination file is. Can anyone help. Thanks.The simpliest way is to take your data and write it to a Comma Dilimeted File which Excel can read without any problems or user intervention. You would use an ObjectOutputStream. Hope this helps.
-
How to transform data received from file adapter
hi',
I am reading the data from XML file using file adapter, now I want to write the same contents which I have read from this file to a different/new XML file, the issue is I am unable to perform a transform here, when I use a transform with source element as the output of the file read and target as the input to the new file it is writing an empty file,
I have checked the audit trail which showsme that the transform is empty.
please tell me how can I transform the element which I have received from one file to make them as input to next file
thanks
Yatanthanks James for input, this is my XML and XSD files
XML file:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<emp>
<name>yatan</name>
<age>28</age>
</emp>
</xsd:schema>
XSD File:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="readfile">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="empid" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I am reading XML file, I will describe my process.
1.) File adapter>read operation ---> receive activity
2.) Transform > source(receive input variable) <--->target(Invoke input variable)
3.) File adapter > write operation ---> invoke activity
Now when I am deploying this process it is sucessfully completing and able to read the file.
when I check the audit trail receive activity shows XML data but when I check the transform it
shows empty as below, however the write activity is performed which creates a xml file but no values in the elements
transform in audit trail
<Invoke_1_Write_InputVariable>
-<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="readfile">
-<readfile xmlns:ns0="http://www.example.org" xmlns="http://www.example.org">
<ns0:name/>
<ns0:empid/>
</readfile>
</part>
</Invoke_1_Write_InputVariable>
this is the code for my .bpel file
<?xml version = "1.0" encoding = "UTF-8" ?>
<!--
Oracle JDeveloper BPEL Designer
Created: Wed May 19 15:04:22 IST 2010
Author: yatanveer.s
Purpose: Empty BPEL Process
-->
<process name="ReadXMLFile2"
targetNamespace="http://xmlns.oracle.com/ReadXMLFile2"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:ns4="http://xmlns.oracle.com/pcbpel/adapter/file/FileReadSync/"
xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:client="http://xmlns.oracle.com/ReadXMLFile2"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/ReadFile/"
xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
xmlns:ns3="http://www.example.org"
xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/file/WriteFile/"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
<!--
PARTNERLINKS
List of services participating in this BPEL process
-->
<partnerLinks>
<partnerLink myRole="Read_role" name="ReadFile"
partnerLinkType="ns1:Read_plt"/>
<partnerLink name="WriteFile" partnerRole="Write_role"
partnerLinkType="ns2:Write_plt"/>
</partnerLinks>
<variables>
<variable name="Receive_1_Read_InputVariable"
messageType="ns1:readfile_msg"/>
<variable name="Invoke_1_Write_InputVariable"
messageType="ns2:readfile_msg"/>
</variables>
<!--
VARIABLES
List of messages and XML documents used within this BPEL process
-->
<!--
ORCHESTRATION LOGIC
Set of activities coordinating the flow of messages across the
services integrated within this business process
-->
<sequence name="main">
<receive name="Receive_1" partnerLink="ReadFile" portType="ns1:Read_ptt"
operation="Read" variable="Receive_1_Read_InputVariable"
createInstance="yes"/>
<assign name="Transform_1">
<bpelx:annotation>
<bpelx:pattern>transformation</bpelx:pattern>
</bpelx:annotation>
<copy>
<from expression="ora:processXSLT('Transformation_3.xsl',bpws:getVariableData('Receive_1_Read_InputVariable','readfile'))"/>
<to variable="Invoke_1_Write_InputVariable" part="readfile"/>
</copy>
</assign>
<invoke name="Invoke_1" partnerLink="WriteFile" portType="ns2:Write_ptt"
operation="Write" inputVariable="Invoke_1_Write_InputVariable"/>
</sequence>
</process> -
Pulling output data from .txt file
Hello, I am trying to have a program that allows a user to input shopping items into the program andhave that input go to a .txt file called shoppinglist, then after the user is finished, he/she can type no to stop entering items to the list and the program will then pull all the info entered to the .txt file and output it to the screen, creating a shooping list for the user. My problem is that I am not quite sure how to output the data from the .txt file to the screen. Here is my code.
import java.io.*; // uses the java io library for the
import java.util.*; // BufferedReader class
public class week5
public static void main(String [] args)
PrintWriter inputItems = null;
try
inputItems = new PrintWriter(new FileOutputStream("shoppinglist.txt"));
BufferedReader outputItems = null;
String line = null;
outputItems = new BufferedReader(new FileReader("shoppinglist.txt"));
line = outputItems.readLine();
outputItems.close();
catch(FileNotFoundException e)
System.out.println("File file.txt not found");
System.out.println("or could not be opened.");
catch(IOException e)
System.out.println("Error reading from file file.txt.");
System.out.println("This program will create a shopping list:");
String keepGoing = "yes";
String item = null;
Scanner keyboard = new Scanner(System.in);
for (int count = 1; count < 999 && keepGoing.equalsIgnoreCase("yes");count++)
//ask for input, write it to a file
System.out.print("Please enter item # " + count + ": ");
System.out.print("");
item = keyboard.nextLine();
inputItems.println(count + " " + item);
//ask if you want to keep going
System.out.print("Do you wish to enter more items (yes/no): ");
System.out.print("");
keepGoing = keyboard.nextLine();
System.out.println("Your shopping list contains: " + item);
System.out.print("");
inputItems.close();
} All the above does is output the last item entered by the user, not the whole shopping list. Any help is greatly appreciated.nim_ramesh wrote:
outputItems = new BufferedReader(new FileReader("shoppinglist.txt"));
/* I think u want to print the text here so */
line = outputItems.readLine(); // Replace this line with that while loop
outputItems.close();
He hasn't even read the user input at that point.
OP, you need to sit down and think about the exact order you want to do things in, and rewrite your code in a logical straightforward manner. It looks like you just threw some code in hoping it would work, instead of coding deliberately. I'm not insulting you or anything, I know you're new to Java. I'm just trying to give you some advice. Look at your code, and ask yourself why the following line of code appears before you've even written anything to your file:
line = outputItems.readLine(); -
How to delete data from a file using IO package
Hi All,
i am trying to remove some content of the file.
this content is not at starting of file not even at end of file.
can anybody tell me how can i delete number of lines from file using IO package.iam having some data in text file .ex:in flowrist.txt
12/5/07,500,300,6000 like many set of datas are
there.In these if i want to delete the data based on
the date which i specified.How to do this specific
deletion?You need to open a stream to read in the file and then use the indexOf method provided in the Sting class to check if the line contains the date or whatever String you are looking for, if so then skip that line and store or re-write the lines you wish to keep, as well as some extra lines you may wish to add.
Take a look below at this example found on Google.
http://www.java-tips.org/java-se-tips/java.io/how-to-read-file-in-java.html
The above read a file line by line and prints it to console. You should be able to modify this, instead of using System.out to print the line you should use index of to check the lines for a date/String. Index of return -1 if the String you specify is not in the line you parse.
Maybe you are looking for
-
Hi! We need to migrate from MS SQL 7.0 to Oracle 8i.We are planning to use OMWB for this.. The database size is 40MB and 250 Tables. The queries are mostly in VBScript.. Approxmately 20 SP and 700 Generated programs are need to be converted.. Can som
-
URGENT -- Problem in using JMS with JBOSS
Hi, My jar file which includes my Java/JMS classes can easily be executed when I use Sun Application server, but I don't know how I can change execute the same jar file in when I switch to JBOSS. Do I need to use ants? or I can use the original jar f
-
Export /Import of Portal -Urgent -Attn Product Mgr Group
I m planning to move my current portal database to other box (Win2000-> HP)and keeping apache and portal tec stack on current box. Which of following method is safe and tested. 1. Export whole data base (8.1.7.3) and import it as a full data base on
-
Application server : Enterprise Manager ias Console - No response
Hi All, We have 10gApplication server infrastructure and the middle tier servives for discoverer installed In the infrastructure tier the Enterprise Manager ias Console is starting up with out any error message, but in the discoverer middle tier the
-
Encrypted email in iOS / exchange domain
hi, i'm using encrypted email time to time on my PC using outlook 2012 and a smartcard.... fine my iphone is set up with this exchange account... fine I was not able to read encryted email (normal!) untill i've exported my certificate to the iphone..