Hi Markus,
you also have to create a new task for switching between read/write operation on the same port. So it's not enough to stop the task, you should clear it and reinitialize with the same channels after that.
Have a look on the DAQmx examples Read/Write from/to digital port on your local folder, that should give you more insight in DAQmx programming with the C-API:
C:\Programme\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\
regards,
Nikolai