473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

I am getting a error code for this C program. It says that FILE is not undelared.

Here is my code so far:

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4.  
  5.  
  6.  
  7.  
  8. int main(void)
  9.  
  10. {
  11.  
  12.  FILE *pRead;
  13. char tmp[10];
  14. size_t stringLength;
  15. int output;
  16. int count;
  17. count =1;
  18. pRead = fopen ("friends.dat", "r");
  19. if (!fin)
  20. {
  21. fprintf (stderr, "Could not open file %s for read!\n","friends.dat");
  22. exit (EXIT_FAILURE);
  23. }
  24.  
  25. while ( 1 )
  26. {
  27.  
  28. char *tmpString;
  29.  
  30. output = fscanf (fin, "%s", tmp);
  31.  
  32. stringLength = strlen (&tmp);
  33.  
  34. tmpString = (char *) calloc (stringLength, sizeof (char));
  35.  
  36. strcpy (tmpString, tmp);
  37.  
  38. if (count %2 == 0)
  39. fprintf (stdout, "%s\n", tmpString);
  40. else
  41. fprintf (stdout, "%s ", tmpString);
  42. if (output == feof)
  43. break;
  44.  
  45. count++;
  46. }
  47.  
Jun 29 '12 #1
5 1980
Sorry FILE is undeclared
Jun 29 '12 #2
weaknessforcats
9,208 Expert Mod 8TB
Please post the exact error. The code you have posted does declare FILE.

Did your stdio.h get successfully included?
Jun 29 '12 #3
divideby0
131 128KB
what is fin declared as? try pRead instead.
Jun 29 '12 #4
Sorry I work second shift here is the error messages, I have attached a screen shot of error messages.
Attached Files
File Type: docx errors.docx (168.5 KB, 435 views)
Jun 30 '12 #5
divideby0
131 128KB
Looks like you need to tell codeblocks where the paths are to the compiler you've chosen to use.

click on the settings menu
click on compiler and debugger

click on the search directories tab

click on the compiler tab to add paths to the includes.
click on the linker tab to add the paths to the lib files

Under the toolchain executables, check that your paths are correct and add any other paths to bin folders under the additional paths tab

Hopefully that will get you going. Good luck
Jun 30 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: bissatch | last post by:
Hi, I have just managed to install DOMXML on my apache/PHP setup. I am running PHP 4.3.0 and Apache2. $xmldoc = domxml_open_file("inc/menu.xml", DOMXML_LOAD_DONT_KEEP_BLANKS); When I try...
10
by: RWC | last post by:
Hello, I'm having a problem that I'm having a lot of trouble with. I'm running Access XP, with all the updates, including service pack 2. I'm on a Windows XP machine. I have a database which...
1
by: nedu | last post by:
Hi, Frndz, Asume that we have some error in stored procedure. We shall control that error by using transactions in Backend(Sql Server). But how z t possible to give the information to the...
1
by: dereski | last post by:
Hey all, I am trying to connect to my database but I am getting error "80004005 Could Not Find File" Any Ideas as to why? I tried recreating the database again, just in case it was corrupted...
1
by: siddu | last post by:
Hi All, I have to do one task. First i need to copy files from vss and run bat files.i have a document with all steps. step 1: we have to take files from vss by using getlatestversion...
2
by: BillB | last post by:
Hi, I've been given a WSDL file and need to convert it to C# so that I can use the procedures it creates, can anyone tell me how to do this? I'm looking at doing it using Visual Studio 2005...
1
by: GGiri | last post by:
Hi, I am trying to post( using httppost) from java application to .NET webpage (.aspx) which is Configured in IIS 5.1, getting the response as error code 500, But i am posting to asp...
1
by: Clueless24 | last post by:
Hi, I am really new to writing code and am trying to do a simple lookup on a form in access but when i run it i keep getting the run time error code '424' which says 'Object is required'. The...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.