SunQuest
           C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 18th, 2002, 03:54 PM
justseven justseven is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 15 justseven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 18 sec
Reputation Power: 0
Send a message via ICQ to justseven Send a message via AIM to justseven
fast way to save data in C

hey guys,

i programed a little webcounter system in C using fastCGI and MySQL. It works fine but i dont log too much data so its ok. Now I am working on version 2 and i am looking for another way to save the data. i think there should be something faster then MySQL because i dont need it to be relational and i think using mysql i waste a lot of performance.

do u have any idea what i could use?

Reply With Quote
  #2  
Old October 5th, 2002, 06:29 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
fopen() ?
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old October 11th, 2002, 08:15 PM
StealthElephant's Avatar
StealthElephant StealthElephant is offline
Shes dancing (obviously)
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2002
Location: the far side
Posts: 526 StealthElephant User rank is Corporal (100 - 500 Reputation Level)StealthElephant User rank is Corporal (100 - 500 Reputation Level)StealthElephant User rank is Corporal (100 - 500 Reputation Level)StealthElephant User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 h 14 m 22 sec
Reputation Power: 8
low level file access is the faster, but there is a learning curve on it,
if u are using linux/unix use
unistd.h
and the fucntion size_t write(int fildes, const void * but, size_t nbytes);
//causes the first nbytes from buf to be written to the file associated with the file descriptor fildes

read is
size_t read(int fildes, void * buf, size_t nbytes);

and open is
int open(const char* path, int oflags); //where oflags are the bitwise OR of mandatory file access mode (i.e readonly, write only, reading and writing)

using these is considerably faster than useing the higher level fstream or FILE*
__________________

microsofts butterfly is their way off telling u their systems have a **** load of buggs
Advocating Linux Guide
Lesbian Linux
Great & Practical Computer Books

like the links?

Reply With Quote
  #4  
Old October 29th, 2002, 09:08 AM
ClayDowling ClayDowling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Flint, MI
Posts: 328 ClayDowling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 25 sec
Reputation Power: 6
Just use the basic stdio file operations. They're portable and quite easy.

#include <stdio.h>

int main() {
FILE* fcount;
int count=0;

fcount = fopen("counter.dat", "r");
if (fcount) {
fscanf(fcount, "%d", &count);
fclose(fcount);
}
count++;
printf("%d visitors", count);

fcount = fopen("counter.dat", "w");
if (fcount) {
fprintf(fcount, "%d", count);
fclose(fcount);
}
else {
printf("Nuts, I can't open the data file.\n");
}

return 0;
}
__________________
Clay Dowling
Lazarus Notes
Articles and commentary on web development
http://www.lazarusid.com/notes/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > fast way to save data in C


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway