- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
When I stored a string to a buffer using Uart, how to print it using same Uart? Something like below but this example using JTAG Uart. <div class='quotetop'>QUOTE </div> --- Quote Start --- int main () { char cStr[80]; printf("Enter a string:\n"); gets (cStr); printf("\n\nString yang anda masukkan ialah:%s\n", cStr); return 0; }[/b] --- Quote End --- I try to do like this but failed... <div class='quotetop'>QUOTE </div> --- Quote Start --- int main () { char* msg = "Enter a string: 't'.\n"; char* msg4 = "Cipher-Text ialah:\n"; FILE* fp; char cStr[80]; fp = fopen ("/dev/uart1","r+"); fwrite (msg, strlen (msg1), 1, fp); gets (cStr); fwrite (msg4, strlen (msg4), 1, fp); fprintf(fp, "%s", cStr); fclose(fp); return 0; }[/b] --- Quote End --- thanks in advanceLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hai ,
i think u had a problem in using the fprintf and fwrite , use fprintf or fwrite in your program ,because fwrite writes in binary format ,but fprintf writes in human readeable format , i think ur problem can be solved with this ... regards, Murugan.b
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page