LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read a character from a file

Solved!
Go to solution

Hi guys

I have a .txt file. In that file the data are stored like "$341ACF12341ACF12341ACF12341ACF12341" now I want to read the next 128 bytes after that "$" character ??

How to execute that??

Thanks in advance

Niladri

0 Kudos
Message 1 of 12
(3,431 Views)

"Read Text File". Then look at the "Search/Split String" and "String Subset" VIs in the String palette to slice and dice it.

0 Kudos
Message 2 of 12
(3,427 Views)

hi Newbee_3,

 

                             Hope this attached image will help you. If not than let me know.

 

Thanks

Ranjeet

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 12
(3,424 Views)

Actually my file contains many $ character as the file gets updated so does the no of "$" character and their is no way to tell how many "$" is their only that each $ character is separated by 127 bytes. That is my main requirement 

Sorry for giving wrong information at the first place

Thanks in advance

Niladri

0 Kudos
Message 4 of 12
(3,418 Views)

Then use an offset to read the latest one... Use kind of FOR loop.

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 12
(3,410 Views)

Can you please elaborate it?

Thanks in advance

Niladri

0 Kudos
Message 6 of 12
(3,406 Views)

what i mean to say that as soon as you read the data & appends on txt file

1. Convert the data into string.

2. Inside for loop read the substring with number of char as 120 & offset as i(Current itearation of FOR loop) * 120.

3. Read the 120 char or bytes & play with it..

 

See i haven't saw your code so i can give you only suggestion, Implementing & placement of components depends on your application.

                                                 If you are not still satisfied than let me know, i will elobrate again with one illustrative image 

Thanks,

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 12
(3,403 Views)

Here, assuming you are reading the entire file rather than line by line:

 

parse.png

 

 

 

 

0 Kudos
Message 8 of 12
(3,401 Views)

You can read the text file to read the data as a string and use $ as a delimiter in Convert spreadsheet string to array.

-----

The best solution is the one you find it by yourself
Message 9 of 12
(3,398 Views)
Solution
Accepted by topic author Newbee_3

Or, use Read From Spreadsheet File.vi with $ as the delimiter.

 

Lynn

Message 10 of 12
(3,375 Views)