Home   Archive   Permalink



program statement

Please send me a program in c++ to make application which will take input like Name,address,phone no,company name and store all content in text file....so that we can read the content of a file
and transfer it to remote location using TCP/IP protocol/RS232 and collect the data received on Ethernet/RS-232 and store in a designated folder in CSV format.......plese send me it by tommorow itself.

posted by:   swati bagade       17-Mar-2013/16:56:17-7:00



Swati, this is a forum about REBOL, not C++. Here's the code in REBOL, to do what you asked with TCP:
    
R E B O L [title: "CSV Save and Transfer"]
write %receiver.r {
     R E B O L []
     print "waiting for file..."
     if error? try [port: first wait open/binary/no-wait tcp://:8008] [quit]
     mark: find file: copy wait port #""
     length: to-integer to-string copy/part file mark
     while [length > length? remove/part file next mark] [append file port]
     write/binary request-file/only/save/file %info.csv file
     alert "received and saved"
}
launch %receiver.r
send-it: does [
     write %info.csv rejoin [
         mold name/text ","
         mold address/text ","
         mold phone/text ","
         mold company/text
         newline
     ]
     print "saved"
     port: open/binary/no-wait join tcp:// ip/text
     insert file: read/binary %info.csv join l: length? file #""
     insert port file
     print "sent"
     unview halt
]
view layout [
     text "Name:"
     name: field
     text "Address:"
     address: field
     text "Phone:"
     phone: field
     text "Company Name:"
     company: field
     text "IP Address:"
     ip: field "127.0.0.1:8008"
     btn "Save and Send" [send-it]
]

posted by:   Nick       18-Mar-2013/7:16:29-7:00



Most of the network code above is copied from my tutorial at http://re-bol.com , section 9.2.4
    
The GUI should be pretty self explanatory too, if you read the first part of the tutorial.

posted by:   Nick       18-Mar-2013/7:24:25-7:00



Info about serial port use is here:
    
http://www.rebol.com/docs/changes-2-5.html#section-81

posted by:   Nick       18-Mar-2013/10:39:14-7:00