C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 3rd, 2003, 01:57 AM
ekta_singh ekta_singh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Mumbai
Posts: 4 ekta_singh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Reading a file.

I have to read a particular file which is Ansys generated and in a particular format...I am attaching the file that has to be read.Actually I was not allowed to attach a simple txt file so I have taken a screen print of my file and attached that.The file is a Wordpad file.As I am not very conversant with C and I've been given this small assignment to be completed urgently,I would be very very grateful if any of you could mail me the code for doing this.

Here's what is to be done...
I need to find out what are the numbers corresponding to a line.For eg. the corresponding numbers for line 1 are 29,30,20,21,18,4,24,26,22.Line 2 only has 6,3,4,5.Line 3 has 31,28,9,7 and 10...and so on.The 0's after N/A are to be ignored and the first 1 for each line is to be ignored.

Thanks in advance for any help.
Attached Images
File Type: jpg read.jpg (83.2 KB, 376 views)

Reply With Quote
  #2  
Old June 3rd, 2003, 02:12 AM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,327 7stud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 44 m 50 sec
Reputation Power: 9
"Actually I was not allowed to attach a simple txt file"

Did it ever cross your mind that this forum is text format?

Reply With Quote
  #3  
Old June 3rd, 2003, 02:21 AM
ekta_singh ekta_singh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Mumbai
Posts: 4 ekta_singh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If I tried to send the file by pasting it here,the formatting would be lost.It wasn't even a txt file really.It was a .lis file generated by Ansys which I used to open with Wordpad.That apart,I would be grateful if anyone could provide a solution to my problem.

Thanks,
-Ekta.

Reply With Quote
  #4  
Old June 3rd, 2003, 03:55 AM
TechNoFear TechNoFear is offline
Offensive Member
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2002
Location: in the perfect world
Posts: 594 TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 14 h 6 m 15 sec
Reputation Power: 21
depends on the target OS. Something like this will do the job.

Code:
OpenFile
FindFilesize
AllocFileBuffer
AllocDataArray
ReadFile
CloseFile
Set pointer to start of file
while(not at end of file)
      find line number
      set right data array element
      while(not end of line)
           move filepointer until next digit
           atoi (file pointer)
           if(data validated)
               copy into data array


if you want full working code it will cost you............
Post your attemp and someone will help if they can.
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

Frank Zappa

Reply With Quote
  #5  
Old June 3rd, 2003, 03:57 AM
ekta_singh ekta_singh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Mumbai
Posts: 4 ekta_singh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Technofear

Thanks a lot for your help Technofear...That was really helpful.Thanks again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Reading a file.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT