How to read the text file present in the Al11 server through our program?
My requirement is that , i have one file already present in the AL11 server. Now i want to take this file so that I can read this file .
So will you please help me , how to read the file from AL11 server in our program ?
Thankx in advance
Hi..
I too agree to the above post .. SEARCH in SCN before posting..
DATA: lv_filename TYPE string, "File name
lv_line TYPE string. "One line entry in a file
lv_filename = iv_file_name.
IF iv_location = gc_application.
IF iv_record_count IS SUPPLIED.
Open file
IF gv_file IS INITIAL.
OPEN DATASET lv_filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT.
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF sy-subrc <> 0.
RAISE file_open_error.
ENDIF.
gv_file = gc_check.
ENDIF.
Read data
DO iv_record_count TIMES.
READ DATASET lv_filename INTO lv_line.
IF sy-subrc <> 0.
Close file
CLOSE DATASET lv_filename.
IF sy-subrc NE 0.
RAISE file_close_error.
ENDIF.
CLEAR gv_file.
Exit from the loop
EXIT.
ENDIF.
Regards
Ansari
Similar Messages
-
How to make an applet to read the Text file present inside a jar
Hi All,
I have writen one applet named ReadFile.java which reads a text file present in the same directory and does some manipulation of text file contents.
The applet code runs successfully when i run the applet in command prompt like
{color:#ff0000}*java ReadFile*{color}
And i am getting the needed results.
Then i made a jar file with the applet code and text file as
{color:#ff0000}*jar cvf rf.jar ReadFile.class File1.txt*{color}
Then i have inlcuded this applet inside a html file as
{color:#ff0000}*<applet code= "ReadFile.class" width= "500" height= "300" archive = "rf.jar" ></applet>*{color}
after this when i load the html file, the applet code is not executed fully. Its throwing FileNotFoundException: File1.txt.
Applet is not recognizing trhe text file present inside the jar file.
Can any body explain me how to overcome this problem. Any setting needs to be done for making the applet indicate the presence of Text file inside the jar file.what code in your applet gets the text file and reads it? are you using getResource or something similar?
-
The program doest enterpret my figures from the text file in the correct way since the numbers contain dots instead of commas. Is there a way to fix this in labVIEW, or do I have to change the files before reading them in the program? Thanks beforehend!
You must go in the labview option menu, you can select 'use the local
separator' in the front side submenu (LV6i).
If you use the "From Exponential/Fract/Eng" vi, you are able to select this
opton (with a boolean) without changing the labview parameters.
(sorry for my english)
Lange Jerome
FRANCE
"Nina" a ecrit dans le message news:
[email protected]..
> I would like to read a text file in which the decimal numbers are
> using dots instead of commas. Is there a way of converting this in
> labVIEW, or how can I get the program to enterpret the figures in the
> correct way?
>
> The program doest enterpret my figures from the text file in the
> correct way since the numbers contain dots instea
d of commas. Is there
> a way to fix this in labVIEW, or do I have to change the files before
> reading them in the program? Thanks beforehend! -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
How to read several text files at a time
Dear all
Read and write one text file is not a problem, but what confusies me is how to read several text files at one time, in the meanwhile,
is it possible to display the name of the text file?
For example, assuming I want to load file" cha 1, cha 2 , cha 3, " at one time and show their names, how to hadle with it
I have reviewed some files and it is not helpfulEither with a 'for' loop like in the lib you have attached, or like this attached VI
that's it
Message Edited by devchander on 05-30-2006 05:11 AM
Attachments:
MULTIPLE READ.vi 44 KB -
How to read a text file using Java
Guys,
Good day!
Please help me how to read a text file using Java and create/convert that text file into XML.
Thanks and God Bless.
Regards,
I-Talkpublic void fileRead(){
File aFile =new File("myFile.txt");
BufferedReader input = null;
try {
input = new BufferedReader( new FileReader(aFile) );
String line = null;
while (( line = input.readLine()) != null){
catch (FileNotFoundException ex) {
ex.printStackTrace();
catch (IOException ex){
ex.printStackTrace();
}This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
cheers
Mohammed Jubaer Arif. -
How to read a text file through pl/sql
How to read a text file through pl/sql
pl/sql runs inside the database. so your file also should be on the database server file system for you to be able to read.
check out UTL_FILE package. This is the database package to read/write files on the database server. -
Pass the text file name to the command prompt using servlet
hi to all,
I have a HTML page that takes the user inputs. Once the user clicks on the submit button on the HTML page, these values will be capture by a servlet and then store into a text file. A new text file is generated each time the user clicks on the submit button.
Now, i need to call a command prompt window and then pass the text file name to another program for execution. Any idea how i can pass the text file name to the command prompt???
Thanx a lot....
kinkihi, thanx 4 ur reply.
But i not onli want to display the file name on the Tomcat command prompt. I must also able to call up a program to execute the command. If i used System.out.println(); it onli display the value on the console windows. But not executing it... anyway where i can do it???.
thanx...
Kinki -
Hi All,
powershell script Method required to read a value from registry and then taking the backup of that values in some text file.
For example the hive is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path
and under path i need to take back up of values in some text file and then put some value in the registry after back is taken in text file.
Also how to read the text file values so that we can again write to registry hive back from the back up text file.
Your help is much appreciated.
Umeed4uI think you need to read this first:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
How to read two text files using the Read from spreadsheet.vi and then plot it
I need to read two text files using the read from spreadsheet function and then plot these files over time.
The file with the .res extention is the RMS values (dt and df) and the second file contains the amplitude of a frequency spectrum.
I really appreciate any help..thanks
Attachments:
RMS.txt 1 KB
FREQUENCY.txt 1 KBFrom NI Example Finder:
Write to Text File.vi
Read from Text File.vi
Jean-Marc
LV2009 and LV2013
Free PDF Report with iTextSharp -
Read a text file before knowing the encoding
Hi,
I've wrote a AppleScript to adjust time delay of *.lrc file(txt file but different extension).I only got a messed up text, in other aspect, it works well. I understand applescript read the text file using the wrong encoding, but I can't just set the encoding to UTF-8, for it can be UTF-8 and it can be Shift-JIS, Big5 andGB18030 as well. I don't know how to open text without getting messed up and write the result to a new text file on desktop using UTF-8 encoding. Can anyone help me with this? Thanks in advance.
Code:
on run
set _lrcFile to (choose file)'s POSIX path
display dialog "Time to delay (sec):" with title "Adjust LRC Delay" default answer "-0.5"
set _timeDelay to text returned of result
try
set _timeDelay to _timeDelay as real
on error
display dialog "Input must be a real" with title "Error" buttons {"Stop"} default button "Stop"
error number -128
end try
set _paraList to paragraphs of (read POSIX file _lrcFile)-->I don't know how to read text file properly here.
set _newLrc to ""
repeat with _para in _paraList
set _timecode to do shell script "sed 's/\\[\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}.[0-9]\\{2\\}\\)\\]\\(.*\\)/\\1 \\2/'<<<" & quoted form of _para
if _timecode as string is not (contents of _para) then
set _timecode to words of _timecode
set _min to (item 1 of _timecode) as integer
set _sec to (item 2 of _timecode) as real
set _sec to _sec + _timeDelay
set _min to _min + _sec div 60
set _sec to _sec mod 60
set _sec to (round (_sec * 100)) / 100
if _min < 10 then
set _min to "0" & _min as string
else
set _min to _min as string
end if
if _sec < 0 then
set _sec to "00.00"
else if _sec < 10 then
set _sec to "0" & _sec as string
else
set _sec to _sec as string
end if
if (count of _sec) < 5 then
set _sec to _sec & "0"
end if
set _lyrics to do shell script "sed 's/\\[\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}.[0-9]\\{2\\}\\)\\]\\(.*\\)/\\3/'<<<" & quoted form of _para
set _newLrc to _newLrc & "[" & _min & ":" & _sec & "]" & _lyrics & return
else
set _newLrc to _newLrc & contents of _para & return
end if
end repeat
-->write _newLrc to destop here (using UTF-8 encoding)
end run
Sample of *.lrc and the result after delaying 0.5s.Hope this post will help people doing their homeworks...
StringBuffer tmpBuffer = new StringBuffer();
try {
URL url = new URL("http://.../test.txt");
URLConnection urlconnection = url.openConnection();
long l = urlconnection.getContentLength();
tmpBuffer.append("Content Length = " + l);
BufferedReader in =
new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = in.readLine()) != null) {
tmpBuffer.append("\n" + line);
in.close();
} catch (Exception e) {
//System.out.println(e.toString());
if (tmpBuffer != null) {
wdContext.currentContextElement().setZoneMessage(
tmpBuffer.toString()); -
How to read any text files using file adapter as it is
Hi,
I need to build bpel process to read any text files as it is.I am file adapter and using opaque schema.But input file is coming as base64encoding format.But i need the input as it is.How can i do that.
Is there any sample schema to read input text files as it is?in java embedding activity i need to remove all newlines from my input text file.During this process i am getting arryindexoutofbounds exception.Below is my code
String input = (String)getVariableData("inputFileStr");
Base64Decoder Decoder = new Base64Decoder();
try
String decoded = Base64Decoder.decode(input); --exception is coming at this line
setVariableData("inputFileStr", decoded);
decoded = decoded.replaceAll("\\n|\\r", "");
byte[] outputBytes = decoded.getBytes();
String reencoded = Base64Encoder.encode(outputBytes);
setVariableData("outputFileStr", reencoded);
catch(Exception uee)
uee.printStackTrace();
below is stack trace:
09/02/26 08:10:33 java.lang.ArrayIndexOutOfBoundsException: -1
09/02/26 08:10:33 at com.collaxa.common.util.Base64DecoderStream.decode(Base64DecoderStream.java:162)
09/02/26 08:10:33 at com.collaxa.common.util.Base64DecoderStream.decode(Base64DecoderStream.java:143)
09/02/26 08:10:33 at com.collaxa.common.util.Base64Decoder.decode(Base64Decoder.java:36) -
How to read a text file through BufferedReader
I want to read a text file by BufferedReader, How can I do that? The format of the file as follows:
NAME MAKER YEAR PRICE CONDITION
13 Dead End Drive __ Milton Bradley 1993 $22.00 C09
18 Wheeler Fever __ Donna Lee Ent. 1980 $20.00 C09
how to parse the line from the file to extract the name, maker, year, price and condition.
Thank you first.Look at: stream tutorials,
BufferedReader, InputStreamReader, FileInputStream, StringTokenizer -
How to read a text file and write text file
Hello,
I have a text file A look like this:
0 0
0 A B C
1 B C D
2 D G G
10
1 A R T
2 T Y U
3 G H J
4 T H K
20
1 G H J
2 G H J
I want to always get rid of last letter and select only the first and last line and save it to another text file B. The output should like this
0 A B
2 D G
1 A R
4 T H
1 G H
2 G H
I know how to read and write a text file, but how can I select the text when I am reading a text file. Can anyone give me an example?
Thank youIf the text file A look like that
0 0
0 3479563,41166 6756595,64723 78,31 1,#QNAN
1 3479515,89803 6756588,20824 77,81 1,#QNAN
2 3479502,91618 6756582,6984 77,94 1,#QNAN
3 3479516,16334 6756507,11687 84,94 1,#QNAN
4 3479519,14188 6756498,54413 85,67 1,#QNAN
5 3479525,61721 6756493,89255 86,02 1,#QNAN
6 3479649,5546 6756453,21824 89,57 1,#QNAN
1 0
0 3478762,36013 6755006,54907 54,8 1,#QNAN
1 3478756,19538 6755078,16787 53,63 1,#QNAN
2 0
3 0
N 0
I want to read the line that before and after 1 0, 2 0, ...N 0 line to arraylist. I have programed the following code
public ArrayList<String>save2;
public BufferedWriter bufwriter;
File writefile;
String filepath, filecontent, read;
String readStr = "" ;
String[]temp = null;
public String readfile(String path) {
int i = 0;
ArrayList<String> save = new ArrayList <String>();
try {
filepath = "D:\\thesis\\Material\\data\\CriticalNetwork\\test3.txt";
File file = new File(filepath);
FileReader fileread = new FileReader(file);
BufferedReader bufread = new BufferedReader(fileread);
this.read = null;
// read text file and save each line content to arraylist
while ((read = bufread.readLine()) != null ) {
save.add(read);
// split each arraylist[i] element by space and save it to String[]
for(i=0; i< save.size();i++){
this.temp = save.get(i).split(" ") ;
// if String[] contain N 0 such as 0 0, 1 0, 2 0 then save its previous and next line from save arraylist to save2 arraylist
if (temp.equals(i+"0")){
this.save2.add(save.get(i));
System.out.println(save2.get(i));
} catch (Exception d) {
System.out.println(d.getMessage());
return readStr;
My code has something wrong. It always printout null. Can anyone help me?
Best Regards,
Zhang -
How to read from text file?
I would like to read data (frequencies) already written in a text file. I will need read these frequencies one at a time to set the function generator (as part of my data acquisition application), acquire data that is in turn written to a file and then go back and read the next frequency from the file to repeat the process again. I also have another idea of doing the same, which is read all the frequencies from the text file and populate a table and a frequency value is picked from the table each time to go through the process mentioned above.
Can anyone suggest the following: (1) How to read from a text file, (2) What could be the most efficient way of solving my above problem.
I am a new LabVIEW user and any help will be appreciated.Hi Research,
Depending on the format of the data file, there are a few options for reading it. If it is tab delimited, you may want to use the Read from SpreadSheet File VI which will read the file into an Array. You can then use the Index Array VI to pull out individual entries. If the files is ASCII but not tab delimited, you could use the regular Open File and Read File VIs. You can either read the file out piece by piece, or read the entire file into a string and then use the Match Pattern VI to parse out the different elements (there are actually many ways to do this - check out the Strings subpalette).
Since you're new to LabVIEW, you may want to check out these resources:
Three Hour Introduction to LabVIEW
Six Hour Introduction to LabVIEW
Getting Started with LabVIEW
I hope this helps! Let us know if you have more questions,
Megan B.
National Instruments
Maybe you are looking for
-
Hallo , I have a problem with convertig a line feed to EBCDIC. I have the following source: String lf = "\n"; try { Writer out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("c:\\Temp\\codepagetest_cp500.txt"),
-
Is there a way to keep the color fill box from changing color each time I select a different cell? I want it to stay the same color I select no matter which cell I click on. I love Mac but having to deal with excel at work, I like how it is setup t
-
Dreamweaver website moves in firefox
Hi I am currently studying IT at college and I am designing a website on dreamweaver but I have created it and it works fine in Internet Explorer but when I open it in Firefox some of the div tags move over to the side. I have used wrapper to keep th
-
JPSTranslate:Custom tag is missing required attribute for
When ever I am placing a label in jsf using RAD i am getting a similar error which i am not able to rectify. And how to integreate swing components in Faces jsp file Please help me out.
-
Problem: 3D functionality is currently disabled due to OpenGL being disabled
I currently downloadedthe trial of Photoshop and i wanted to import a model from 3DS Max and i was given the "Could not complete your request because 3D functionality is currently disabled due to OpenGL being disabled" .This is very fustrating and i