by zebsadiq
4. February 2011 11:40
If you’re trying to get going with GNUstep, you follow all of the instructions but you come accross the following message:
File NSData.m:1413 In[NSData writeToFile.options:error:] Open (/home/USER/ProjectFolder/Filenamea12345) failed – The system cannot find the file specified.
This error is caused because the path can really not be found. I discovered that you need the full windows path to the file including ‘c:/’ . This was a little confusing at first but it does make sense. Remember that you’ll need to user forward slashes (‘/’) rather than back slashes. The working code becomes:
int main(void)
{
CREATE_AUTORELEASE_POOL(pool);
NSString *filename = @"C:/GNUstep/home/z.sadiq/ObjectiveC/test.txt";
NSString *name = @"This string was created by GNUstep";
if([name writeToFile:filename atomically:YES])
{
NSLog(@"Success");
}
else
{
NSLog(filename);
NSLog(@"Failure");
}
RELEASE(pool);
return 0;
}