Jump to content

Help with file opening

Go to solution Solved by Avratz,

You need to properly escape your slashes

 

\\\\psf\\Home..

Hey,

 

not really sure what details you will want to know but I'm coding in C using microsoft visual studio (this is running on an emulated version of windows 8.1 - using a macbook pro with parallels desktop 10 to run both mac/windows at the same time). 

 

okay so my issue is that i cannot open a file, i have an assignment where i need to open two, so I'm starting with opening one for now.

i've created a document called initial1.txt 

heres my code, someone helps me cause I'm confused as heck!

 

//This program is made for the purpose of text file analysis and merging of text files

//This program was first created 3/12/2014

//Made by Laurence Potter LP379

#include <stdio.h>

#include <stdlib.h>

 

 

 

FILE *file_in;

 

 

int main(void)

 

{

 

errno_t err;

 

char ccount[25];

 

err = fopen_s(&file_in, "\\psf\Home\Documents\Visual Studio 2013\Projects\MiniProject\MiniProject\Debug\initial1.txt", "r");

if (err == 0)

{

printf("The file 'initial1' was opened\n");

}

else

{

printf("The file 'initial1' was not opened\n");

}

 

fscanf_s(file_in, "%s", ccount);

 

printf("%s", ccount);

 

fclose(file_in);

 

return 0;

}

Spoiler

Gaming/Engineering PC: -i7 6700K, 4-4.2GHz "Eleanor" -ASUS ROG HERO VIII MOBO -16GB DDR4 3000MHz Corsair (2x8GB) -Gigabyte Windforce 980Ti OC edition (1405MHz GPU clock) -H110i GT Corsair CPU Water cooler -980GB Sandisk Ultra II SSD -Corsair 450D ATX Case -RM850i Corsair PSU (Modular) -28” 4K Samsung -27” 1080p Samsung 

Link to comment
Share on other sites

Link to post
Share on other sites

not sure if this pic will help

post-16255-0-49170800-1417625559_thumb.p

Spoiler

Gaming/Engineering PC: -i7 6700K, 4-4.2GHz "Eleanor" -ASUS ROG HERO VIII MOBO -16GB DDR4 3000MHz Corsair (2x8GB) -Gigabyte Windforce 980Ti OC edition (1405MHz GPU clock) -H110i GT Corsair CPU Water cooler -980GB Sandisk Ultra II SSD -Corsair 450D ATX Case -RM850i Corsair PSU (Modular) -28” 4K Samsung -27” 1080p Samsung 

Link to comment
Share on other sites

Link to post
Share on other sites

You need to properly escape your slashes

 

\\\\psf\\Home..

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

You need to properly escape your slashes

 

\\\\psf\\Home..

mfw

 

thank you so much, trying to program the rest of the assignment around this issue was hard... now its rectified you've made my life a thousand times easier!

Spoiler

Gaming/Engineering PC: -i7 6700K, 4-4.2GHz "Eleanor" -ASUS ROG HERO VIII MOBO -16GB DDR4 3000MHz Corsair (2x8GB) -Gigabyte Windforce 980Ti OC edition (1405MHz GPU clock) -H110i GT Corsair CPU Water cooler -980GB Sandisk Ultra II SSD -Corsair 450D ATX Case -RM850i Corsair PSU (Modular) -28” 4K Samsung -27” 1080p Samsung 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×