Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Read Write ANSI/C

Read Write ANSI/C

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionsysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gls2ro
    wrote on last edited by
    #1

    Hello! I have another problem. I want to make 2 programs a client and a server. This programs must access the same file and read/write into it. EXAMPLE: if the client write to the file: #CLIENT 1 REQUEST the server must read this and response: #S CLIENT 1 REPLAY Now this is the problem: I want to do this in client: while (1) { read from file; if string readed containt #S CLIENT 1 { do some action Ex: write to file #RESPONSE ACCEPTED } } and I want that client to do this forever. And I want the same to do the server. Now How do I open/read/write to file? Or how to do this? Only ANSI/C code. Thank You! Bye!

    A 1 Reply Last reply
    0
    • G gls2ro

      Hello! I have another problem. I want to make 2 programs a client and a server. This programs must access the same file and read/write into it. EXAMPLE: if the client write to the file: #CLIENT 1 REQUEST the server must read this and response: #S CLIENT 1 REPLAY Now this is the problem: I want to do this in client: while (1) { read from file; if string readed containt #S CLIENT 1 { do some action Ex: write to file #RESPONSE ACCEPTED } } and I want that client to do this forever. And I want the same to do the server. Now How do I open/read/write to file? Or how to do this? Only ANSI/C code. Thank You! Bye!

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Hi The program that write the file have to make a fflush to write the data to the file otherwise the data is only in memory... after that the other program can read de info...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups