Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Data Transfer
Data Transfer [message #33434] Fri, 05 August 2011 12:40 Go to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Hi All,


I have created a GUI with a Grid layout. Now i need to know how to read the data[Alpha-numeric,binary] into the grid from the file of .log or .txt format.

Regards
Re: Data Transfer [message #33435 is a reply to message #33434] Fri, 05 August 2011 12:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello Shwetha

Do you mean you want to fill a GridCtrl with data read from a text file?


Best regards
Iñaki
Re: Data Transfer [message #33436 is a reply to message #33435] Fri, 05 August 2011 12:53 Go to previous messageGo to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
yes Mr.Koldo.
Re: Data Transfer [message #33438 is a reply to message #33436] Fri, 05 August 2011 13:40 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Parse the data from the file and then direct that data to the location in the grid where you want it to go.

So far I have just used Alpha-numeric and placed the data into an edit field or label, usually running it through math functions in between.

Just parsing the data should be straight forward if the file format is consistent. If the file contains something like comma delimited data that goes into the grid in sequence it shouldn't be a problem, otherwise some logic and maybe formatting the binary data may be necessary.
Re: Data Transfer [message #33440 is a reply to message #33438] Sat, 06 August 2011 06:23 Go to previous messageGo to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Thank you will try & come back on the same.

[Updated on: Sat, 06 August 2011 07:01]

Report message to a moderator

Re: Data Transfer [message #33453 is a reply to message #33440] Tue, 09 August 2011 08:38 Go to previous messageGo to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Hii Frnd,

I have attached the log file which i wanna read into the grid[single column,multiple rows] layout.It should read 32 bit data into each row.

kindly help me by providing code to read this log file into the grid.

Awaiting for your reply
Thanks in advance.
  • Attachment: test2.log
    (Size: 6.44KB, Downloaded 218 times)
Re: Data Transfer [message #33454 is a reply to message #33453] Tue, 09 August 2011 09:01 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello Shwetha

Do you mean to pass the first three lines and after that, read four columns with a 32 bits number in hexadecimal in each one, for all the rows until an empty newline is found?


Best regards
Iñaki
Re: Data Transfer [message #33456 is a reply to message #33454] Tue, 09 August 2011 10:54 Go to previous messageGo to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
No, I just wanna read that data into grid, line by line or 32bit data at a time.

I wanna know the code lines, to read the data from the log file & fill tht into the grid.
Re: Data Transfer [message #33460 is a reply to message #33456] Tue, 09 August 2011 12:36 Go to previous message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello Shwetha

I do not understand you very well.

However you can try this and we can modify it to get what you need:

grid.AddColumn("Data");
String data = LoadFile(AppendFileName(GetDesktopFolder(), "test2.log"));
for (int row = 0, ind = 0; true; row++) {
	int endLine = data.Find('\n', ind);
	if (endLine == -1)
		endLine = data.GetCount()-1;
	String rowText = data.Mid(ind, endLine-ind);
	ind = endLine+1;
	if (rowText.IsEmpty())
		break;
	grid.Set(row, 0, rowText);
}

index.php?t=getfile&id=3408&private=0
  • Attachment: dib.PNG
    (Size: 8.12KB, Downloaded 400 times)


Best regards
Iñaki
Previous Topic: Block indent and dedent
Next Topic: 2 questions on ArrayCtrl and tray
Goto Forum:
  


Current Time: Thu May 02 18:49:37 CEST 2024

Total time taken to generate the page: 0.02769 seconds