|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
Did you or anyone else successfully get a log running on their cRio? We are trying to do something similar, and we have had consistent success with creating the file but very spotty success when writing to it (depending on where the lines are added in the code). Sometimes it works sometimes it doesn't.
|
|
#17
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
I know this is quite a bump, but now I'm even having problems using C file I/O with FILE* pointers. I've called Priv_SetWriteAllowed(1) and still weird stuff happens. Sometimes things work fine, but there's a boat load of issues most of the time:
Does anybody have any idea what could be causing this? It's making things very difficult and I can't imagine why it would be happening. Last edited by slavik262 : 25-01-2010 at 19:47. |
|
#18
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
I've found that some parts of the STL do not work with well/at all Wind River. I tried to use std::fstream to store some packet data, but had to use c-style file I/O for it to work.
|
|
#19
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
Quote:
![]() |
|
#20
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
Interesting. What permissions are you using? I used "w".
|
|
#21
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
I was using w. I guess I could try wb or w+, but I was just writing text...
|
|
#22
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
I (finally!) got a chance to test this again.
code (in auto) Code:
ofstream txt;
txt.open("test.txt");
txt<<"IT WORKS!!!"<<endl;
|
|
#23
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
Exactly! That's what's so odd about it. It's not even that it doesn't work, but that it works inconsistantly with no changes except filenames. I have no idea what could be causing the problem. It's so frustrating.
![]() On the note of standard library things failing, does anyone have issues with std::cout? printf() works fine, but cout refuses to print a thing. I'm using the VxWorks Target Console in WindRiver. |
|
#24
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
Quote:
streambuf *cerbuf=cerr.rdbuf(); cout.rdbuf(cerbuf); EDIT: now that I think about it, the getting started guided called it printf/cout output. strange they did not get it working with that title |
|
#25
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
Quote:
It never bothered me, though since I like to format the things I print and inserting magic format objects feels like a lame hack compared to a concise format string. Oh well... preferences, I guess. -Joe |
|
#26
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
Quote:
-Joe |
|
#27
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
I agree that behavior like this sounds like a race condition, but why would a race occur for a file stream, especially to a file that's not used by any other part of the system?
Last edited by slavik262 : 03-02-2010 at 10:37. |
|
#28
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
Quote:
-Joe |
|
#29
|
||||
|
||||
|
Re: ofstream (standard C++ file output) not working
From my understanding, you call Priv_SetWriteFileAllowed(1) to allow a file write operation and then call fopen() as usual.
|
|
#30
|
|||
|
|||
|
Re: ofstream (standard C++ file output) not working
Quote:
The way I understand it, it enables write access to the filesystem as a whole. In other words, if no one calls it, noone can write to the disk. If anyone calls it, then anyone can write to the disk (or open for write). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| p2 not working? | Lone_Wolf92c | Programming | 5 | 22-02-2008 08:49 |
| IR Board Not Working (But NOT Fried) | itsme | Electrical | 2 | 18-02-2008 06:11 |
| Beware - transmission output shaft is not 5/8"! | jskene | Kit & Additional Hardware | 30 | 13-02-2006 14:01 |
| Drive() Not a Standard Toolset in EasyC? | Chris_Elston | Programming | 3 | 08-02-2006 09:01 |
| Beware - transmission output shaft is not 5/8"! | jskene | Technical Discussion | 3 | 19-01-2006 14:24 |