| | |
fwrite(size_t_count)
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Heheh :] wts happening here 
wel
for each line in the source file
read a line <----------------------------- thats easy !
replace all commas with semicolons <--------- i'll try my best
write the string to the new file <------------- kinda of problem in here coz i have some int arrays example:
its easy to use fputs for the char item[50] but still struggling with int cust_num (conversion) i'll appreciate any help !
example:
1 more thing i tried to write rSales[i].cust_num using
but the problem that i'm getting some ASCII codes in fpr
end<------------Thx for help guyz

wel
for each line in the source file
read a line <----------------------------- thats easy !
replace all commas with semicolons <--------- i'll try my best
write the string to the new file <------------- kinda of problem in here coz i have some int arrays example:
int cust_num; char item[50]; int cost;
its easy to use fputs for the char item[50] but still struggling with int cust_num (conversion) i'll appreciate any help !
example:
fputs(rSales[i].cust_num,fpr);1 more thing i tried to write rSales[i].cust_num using
fputc(rSales[i].cust_num,fpr);but the problem that i'm getting some ASCII codes in fpr
end<------------Thx for help guyz
DarkCoder+
Convert cust_num to string for example with sprintf.
C Syntax (Toggle Plain Text)
char buff[MAX]; sprintf(buff, "%d", cust_num); fputs(buff, fpr); /* and for fputc */ fputc(cust_num + '0', fpr); /* suposing that cust_num is less than 10 and smalles 0 */
If you want to win, you must not loose (Alan Ford)
•
•
•
•
Convert cust_num to string for example with sprintf.
C Syntax (Toggle Plain Text)
char buff[MAX]; sprintf(buff, "%d", cust_num); fputs(buff, fpr); /* and for fputc */ fputc(cust_num + '0', fpr); /* suposing that cust_num is less than 10 and smalles 0 */
i have kinda of phobia from conversion ! do u know any good site for conversions !
thx mate :!:
DarkCoder+
you don't really need sprintf at all. just use fprintf()
int cust_num = 123;
fprintf(fpr, "%d\n", cust_num);
// now if you want the number to have at least 5 digits, with leading 0s when needed
fprintf(fpr, "%05d\n", cust_num); Last edited by Ancient Dragon; Oct 6th, 2006 at 8:36 am.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
•
•
Where did this conversion come in? I thought you were reading each line and replacing , with ;. There should be no conversions anywhere.
s1.csv contents:
2,Ajle,1999999,235.6,6
3,ksiSeal,1062230,222.8,2
...
...
...
the second program is reading from the same file s1.csv and and write it to a new *.txt file with replacing the delimiter "," with a delimiter ";" and by doin some ascending sort....
example *.txt contents:
2;Ajle;1999999;235.6;6
3;ksiSeal;1062230;222.8;2
...
...
...
and we have a fix struct in both programs
so thats why i was doin conversion ! Anyways i'm bout to finish it all still have the sort part and bang finish !

thx alote guyz
DarkCoder+
![]() |
Other Threads in the C Forum
- Previous Thread: qt3 designer help
- Next Thread: help required!!!!!
Views: 3895 | Replies: 19
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory drawing dynamic executable execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest homework i/o ide include infiniteloop initialization interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send single socketprogramming spoonfeeding stack standard strchr string student suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32 win32api windows.h






