views:

53

answers:

1

i get errors when i try to open a file using the file path

out_stream5.open("C:pathshowitems.txt", ios::out);

warning C4129: 'o' : unrecognized character escape sequence error C2100: illegal indirection

+2  A: 

I presume you're working on Windows. The problem is probably that you need to escape the backslashes:

out_stream5.open("C:\\path\\showitems.txt", ios::out);
wilhelmtell
Yes, thats my guess also, because `\p` is not a valid escape sequence.
AraK
heh things can get funnier when you have a directory that starts with 0 (zero).
wilhelmtell
and using the specific file path to open the file wont open the file correctly
@user320950 I'm not sure I follow you. Did you try entering the complete correct path with all backslashes escaped?
wilhelmtell
yeah i did it correctly i think i posted my most recent codePrograms won’t write to a file, and I do not know if it is reading itand i think this is the thing that is stopping my files from reading and writing
Are you on Windows? That path doesn't look like a valid Windows path. Also, can you please post more code for context?
wilhelmtell
I am still having trouble getting my files to open correctly1>Project : error PRJ0003 : Error spawning 'rc.exe'. i get this error when i do this now. this is a practice programin.open("C:\\Users\\MO\\Documents\\grades.txt", ios::in);out.open("C:\\Users\\MO\\Documents\\grades1.txt", ios::out);
yes i am using windows
this sounds like it has nothing to do with the original problem. it sounds like visual studio has issues running some executable. a bit of googling suggests that maybe if you AVG antivirus that placed that file "in the vault" because it thought it was a virus. try to play with that, see if you can restore the file back in place.
wilhelmtell