|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
"Actually I was not allowed to attach a simple txt file"
Did it ever cross your mind that this forum is text format? |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Thanks Technofear
Thanks a lot for your help Technofear...That was really helpful.Thanks again.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Reading a file. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|