•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 423,380 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,799 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 3817 | Replies: 2
![]() |
•
•
Join Date: Aug 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
as title mentioned, i face problem with convert a jumbled text file to unjumbled text file, some of you might not clear what i am saying, well a example will give a clear idea what this all about.
jumbled text file contain a few line of number,
after unjumbled it, a cute bear will show up...
seriously i dun have any idea how to do this...
jumbled text file contain a few line of number,
after unjumbled it, a cute bear will show up...
seriously i dun have any idea how to do this...
•
•
Join Date: Jun 2004
Location: Marin, CA, USA
Posts: 434
Reputation:
Rep Power: 5
Solved Threads: 9
Ok,that can be done quite easily if you know your file handling and a little bit of char manipulation.
If you want a tutorial on file handling then here is a link.
http://www.daniweb.com/techtalkforums/thread6542.html
Now here is an idea on how to do it.
1.First open the jumbled file
2.Open an output file
3.Read a line from the jumbled file
Now let the line be like:12 0000000XX0000XXXXXX
4.Get the line no (i.e 12) by copying the letter for the read line till you reach a space
5.If the number is the current line (i.e 1) then write to output file
6.Do this till all the lines are done and keep repeating the jumbled file reading.
Ok simple eh,but it's not too good or efficient but should do the job.Also to convert a char array which holds a num like "2324" into a int use atoi() (#include stdlib.h)
char char_num[] = "sdfsd";
int x = atoi(char_num);
If you want a tutorial on file handling then here is a link.
http://www.daniweb.com/techtalkforums/thread6542.html
Now here is an idea on how to do it.
1.First open the jumbled file
2.Open an output file
3.Read a line from the jumbled file
Now let the line be like:12 0000000XX0000XXXXXX
4.Get the line no (i.e 12) by copying the letter for the read line till you reach a space
5.If the number is the current line (i.e 1) then write to output file
6.Do this till all the lines are done and keep repeating the jumbled file reading.
Ok simple eh,but it's not too good or efficient but should do the job.Also to convert a char array which holds a num like "2324" into a int use atoi() (#include stdlib.h)
char char_num[] = "sdfsd";
int x = atoi(char_num);
![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- C++ Reading from a text file (C++)
- Search string in a text file (C)
- read text file (C)
- Convert fixed width text file to .csv (Java)
- Scan text file to find all words of 4 characters or less (Shell Scripting)
- New User (C)
- Help Reading Info in Text File Into an Array (C++)
- Problems of looping in saving to a text file (C)
- How to send text to a text file using j2me through http connection? (Java)
Other Threads in the C Forum
- Previous Thread: Help a new member
- Next Thread: message passing interfaces


Linear Mode